Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fe1338

Browse files
committed
Named arg for infix is a migration warning
1 parent 241446d commit 9fe1338

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/compiler/scala/tools/nsc/ast/parser/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ self =>
10141014
def mkNamed(args: List[Tree]) = if (!isExpr) args else
10151015
args.map(treeInfo.assignmentToMaybeNamedArg(_))
10161016
.tap(res => if (currentRun.isScala3 && args.lengthCompare(1) == 0 && (args.head ne res.head))
1017-
deprecationWarning(args.head.pos.point, "named argument is deprecated for infix syntax", since="2.13.16"))
1017+
migrationWarning(args.head.pos.point, "named argument is deprecated for infix syntax", since="2.13.16"))
10181018
var isMultiarg = false
10191019
val arguments = right match {
10201020
case Parens(Nil) => literalUnit :: Nil

test/files/neg/infix-named-arg.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
infix-named-arg.scala:5: warning: named argument is deprecated for infix syntax
1+
infix-named-arg.scala:4: error: named argument is deprecated for infix syntax
2+
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress.
3+
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration
24
def f = 42 + (x = 1)
35
^
4-
error: No warnings can be incurred under -Werror.
5-
1 warning
66
1 error

test/files/neg/infix-named-arg.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
//> using options -Werror -Xlint -Xsource:3
1+
//> using options -Xsource:3
32

43
class C {
54
def f = 42 + (x = 1)

0 commit comments

Comments
 (0)