-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecation warnings for old syntax: alphanumeric infix operators
This is the first part of #18870
- Loading branch information
1 parent
5f4f7c6
commit f2f004d
Showing
26 changed files
with
121 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//> using options -Werror | ||
|
||
import language.`3.4` | ||
|
||
class Foo: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i | ||
|
||
def test(foo: Foo): Unit = | ||
foo x 1 // error (because it was compiled with 3.4+) | ||
foo y 2 // ok: is marked as infix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- Error: tests/neg/alphanumeric-infix-operator.scala:8:6 -------------------------------------------------------------- | ||
8 | foo x 1 // error (because it was compiled with 3.4+) | ||
| ^ | ||
| Alphanumeric method x is not declared infix; it should not be used as infix operator. | ||
| Instead, use method syntax .x(...) or backticked identifier `x`. | ||
| The latter can be rewritten automatically under -rewrite -source 3.4-migration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//> using options -Werror | ||
|
||
class Foo: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i | ||
|
||
def test(foo: Foo): Unit = | ||
foo x 1 // error (because it was compiled with 3.4+) | ||
foo y 2 // ok: is marked as infix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/pos/alphanumeric-infix-operator-compat/A_1_c3.0.0.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class A: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i |
3 changes: 3 additions & 0 deletions
3
tests/pos/alphanumeric-infix-operator-compat/B_1_c3.1.0.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class B: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i |
3 changes: 3 additions & 0 deletions
3
tests/pos/alphanumeric-infix-operator-compat/C_1_c3.2.0.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class C: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i |
3 changes: 3 additions & 0 deletions
3
tests/pos/alphanumeric-infix-operator-compat/D_1_c3.3.0.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class D: | ||
def x(i: Int) = i | ||
infix def y(i: Int) = i |
15 changes: 15 additions & 0 deletions
15
tests/pos/alphanumeric-infix-operator-compat/Test3.4_2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//> using options -Werror | ||
|
||
import language.`3.4` | ||
|
||
def test1(a: A, b: B, c: C, d: D): Unit = | ||
a x 1 // ok: was compiled with 3.0 | ||
b x 1 // ok: was compiled with 3.1 | ||
c x 1 // ok: was compiled with 3.2 | ||
d x 1 // ok: was compiled with 3.3 | ||
|
||
// ok: is marked as infix | ||
a y 2 | ||
b y 2 | ||
c y 2 | ||
d y 2 |
13 changes: 13 additions & 0 deletions
13
tests/pos/alphanumeric-infix-operator-compat/TestFuture_2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import language.future | ||
|
||
def test2(a: A, b: B, c: C, d: D): Unit = | ||
a x 1 // ok: was compiled with 3.0 | ||
b x 1 // ok: was compiled with 3.1 | ||
c x 1 // ok: was compiled with 3.2 | ||
d x 1 // ok: was compiled with 3.3 | ||
|
||
// ok: is marked as infix | ||
a y 2 | ||
b y 2 | ||
c y 2 | ||
d y 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters