File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -740,8 +740,9 @@ trait Checking {
740
740
! infixOKSinceFollowedBy(tree.right) &&
741
741
ctx.settings.strict.value =>
742
742
ctx.deprecationWarning(
743
- i """ alphanumeric method $name is not declared @infix; should not be used as infix operator.
744
- |The operation can be rewritten automatically to ` $name` under -deprecation -rewrite """ ,
743
+ i """ Alphanumeric method $name is not declared @infix; it should not be used as infix operator.
744
+ |The operation can be rewritten automatically to ` $name` under -deprecation -rewrite.
745
+ |Or rewrite to method syntax . $name(...) manually. """ ,
745
746
tree.op.sourcePos)
746
747
if (ctx.settings.deprecation.value) {
747
748
patch(Span (tree.op.span.start, tree.op.span.start), " `" )
Original file line number Diff line number Diff line change
1
+ // Compile with -strict -Xfatal-warnings -deprecation
2
+ import scala .annotation .infix
3
+ class C {
4
+ @ infix def op (x : Int ): Int = ???
5
+ def meth (x : Int ): Int = ???
6
+ }
7
+
8
+ val c = C ()
9
+ def test () = {
10
+ c op 2
11
+ c.meth(2 )
12
+
13
+ c.op(2 )
14
+ c meth 2 // error: should not be used as infix operator
15
+ }
You can’t perform that action at this time.
0 commit comments