File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1120,9 +1120,14 @@ object Parsers {
11201120 if (prec < opPrec || leftAssoc && prec == opPrec) {
11211121 opStack = opStack.tail
11221122 recur {
1123- atSpan(opInfo.operator.span union opInfo.operand.span union top.span) {
1123+ atSpan(opInfo.operator.span union opInfo.operand.span union top.span):
1124+ def deprecateInfixNamedArg (t : Tree ): Unit = t match
1125+ case Tuple (ts) => ts.foreach(deprecateInfixNamedArg)
1126+ case Parens (t) => deprecateInfixNamedArg(t)
1127+ case t : Assign => report.deprecationWarning(em " named argument is deprecated for infix syntax " , t.srcPos)
1128+ case _ =>
1129+ deprecateInfixNamedArg(top)
11241130 InfixOp (opInfo.operand, opInfo.operator, top)
1125- }
11261131 }
11271132 }
11281133 else top
Original file line number Diff line number Diff line change 1+ //> using options -deprecation
2+
3+ class C {
4+ def f = 42 + (x = 1 ) // warn
5+ def multi (x : Int , y : Int ): Int = x + y
6+ def g = new C () `multi` (x = 42 , y = 27 ) // warn // warn
7+ }
You can’t perform that action at this time.
0 commit comments