@@ -933,35 +933,35 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
933
933
val coreSig =
934
934
if isExtension then
935
935
val paramss =
936
- // if tree.name.isRightAssocOperatorName then
937
- // // If you change the names of the clauses below, also change them in right-associative-extension-methods.md
938
- // // we have the following encoding of tree.paramss:
939
- // // (leftTyParams ++ leadingUsing
940
- // // ++ rightTyParams ++ rightParam
941
- // // ++ leftParam ++ trailingUsing ++ rest)
942
- // // e.g.
943
- // // extension [A](using B)(c: C)(using D)
944
- // // def %:[E](f: F)(g: G)(using H): Res = ???
945
- // // will have the following values:
946
- // // - leftTyParams = List(`[A]`)
947
- // // - leadingUsing = List(`(using B)`)
948
- // // - rightTyParams = List(`[E]`)
949
- // // - rightParam = List(`(f: F)`)
950
- // // - leftParam = List(`(c: C)`)
951
- // // - trailingUsing = List(`(using D)`)
952
- // // - rest = List(`(g: G)`, `(using H)`)
953
- // // we need to swap (rightTyParams ++ rightParam) with (leftParam ++ trailingUsing)
954
- // val (leftTyParams, rest1) = tree.paramss.span(isTypeParamClause)
955
- // val (leadingUsing, rest2) = rest1.span(isUsingClause)
956
- // val (rightTyParams, rest3) = rest2.span(isTypeParamClause)
957
- // val (rightParam, rest4) = rest3.splitAt(1)
958
- // val (leftParam, rest5) = rest4.splitAt(1)
959
- // val (trailingUsing, rest6) = rest5.span(isUsingClause)
960
- // if leftParam.nonEmpty then
961
- // leftTyParams ::: leadingUsing ::: leftParam ::: trailingUsing ::: rightTyParams ::: rightParam ::: rest6
962
- // else
963
- // tree.paramss // it wasn't a binary operator, after all.
964
- // else
936
+ if tree.name.isRightAssocOperatorName && ! tree.mods.is( Infix ) && ! tree.symbol.is( Infix ) then
937
+ // If you change the names of the clauses below, also change them in right-associative-extension-methods.md
938
+ // we have the following encoding of tree.paramss:
939
+ // (leftTyParams ++ leadingUsing
940
+ // ++ rightTyParams ++ rightParam
941
+ // ++ leftParam ++ trailingUsing ++ rest)
942
+ // e.g.
943
+ // extension [A](using B)(c: C)(using D)
944
+ // def %:[E](f: F)(g: G)(using H): Res = ???
945
+ // will have the following values:
946
+ // - leftTyParams = List(`[A]`)
947
+ // - leadingUsing = List(`(using B)`)
948
+ // - rightTyParams = List(`[E]`)
949
+ // - rightParam = List(`(f: F)`)
950
+ // - leftParam = List(`(c: C)`)
951
+ // - trailingUsing = List(`(using D)`)
952
+ // - rest = List(`(g: G)`, `(using H)`)
953
+ // we need to swap (rightTyParams ++ rightParam) with (leftParam ++ trailingUsing)
954
+ val (leftTyParams, rest1) = tree.paramss.span(isTypeParamClause)
955
+ val (leadingUsing, rest2) = rest1.span(isUsingClause)
956
+ val (rightTyParams, rest3) = rest2.span(isTypeParamClause)
957
+ val (rightParam, rest4) = rest3.splitAt(1 )
958
+ val (leftParam, rest5) = rest4.splitAt(1 )
959
+ val (trailingUsing, rest6) = rest5.span(isUsingClause)
960
+ if leftParam.nonEmpty then
961
+ leftTyParams ::: leadingUsing ::: leftParam ::: trailingUsing ::: rightTyParams ::: rightParam ::: rest6
962
+ else
963
+ tree.paramss // it wasn't a binary operator, after all.
964
+ else
965
965
tree.paramss
966
966
val trailingParamss = paramss
967
967
.dropWhile(isUsingOrTypeParamClause)
0 commit comments