forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement automatic rewrites for named infix arguments interpreted as…
… named tuples
- Loading branch information
1 parent
ad3f38d
commit f085145
Showing
13 changed files
with
106 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
class C: | ||
def f = 42 + (x = 1) // error // a named tuple! | ||
def f = 42 + (x = 1) // error // werror | ||
def multi(x: Int, y: Int): Int = x + y | ||
def **(x: Int, y: Int): Int = x + y | ||
def g = new C() `multi` (x = 42, y = 27) // werror // werror // not actually a tuple! appearances to the contrary | ||
def h = new C() ** (x = 42, y = 27) // werror // werror | ||
def g = new C() `multi` (x = 42, y = 27) // werror | ||
def h = new C() ** (x = 42, y = 27) // werror | ||
|
||
type X = (x: Int) | ||
|
||
class D(d: Int): | ||
def **(x: Int): Int = d * x | ||
def **(x: X): Int = d * x.x | ||
def f = this ** (x = 2) | ||
def g = this ** 2 // error | ||
def f = this ** (x = 2) // werror | ||
def g = this ** 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class C: | ||
def multi(x: Int, y: Int): Int = x + y | ||
def **(x: Int, y: Int): Int = x + y | ||
def g = new C().multi(x = 42, y = 27) | ||
def h = new C().**(x = 42, y = 27) | ||
|
||
type X = (x: Int) | ||
|
||
class D(d: Int): | ||
def **(x: Int): Int = d * x | ||
def **(x: X): Int = d * x.x | ||
def f = this.**(x = 2) | ||
def g = this ** 2 | ||
def h = this ** ((x = 2)) | ||
def i = this.**(x = (1 + 1)) |
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 @@ | ||
class C: | ||
def multi(x: Int, y: Int): Int = x + y | ||
def **(x: Int, y: Int): Int = x + y | ||
def g = new C() `multi` (x = 42, y = 27) | ||
def h = new C() ** (x = 42, y = 27) | ||
|
||
type X = (x: Int) | ||
|
||
class D(d: Int): | ||
def **(x: Int): Int = d * x | ||
def **(x: X): Int = d * x.x | ||
def f = this ** (x = 2) | ||
def g = this ** 2 | ||
def h = this ** ((x = 2)) | ||
def i = this ** (x = (1 + 1)) |
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,14 @@ | ||
//> using options -source:3.6-migration | ||
class C: | ||
def f = 42 + (x = 1) // warn // interpreted as 42.+(x = 1) under migration, x is a valid synthetic parameter name | ||
def multi(x: Int, y: Int): Int = x + y | ||
def **(x: Int, y: Int): Int = x + y | ||
def g = new C() `multi` (x = 42, y = 27) // warn | ||
def h = new C() ** (x = 42, y = 27) // warn | ||
|
||
type X = (x: Int) | ||
|
||
class D(d: Int): | ||
def **(x: Int): Int = d * x | ||
def f = this ** (x = 2) // warn | ||
def g = this ** 2 |
This file was deleted.
Oops, something went wrong.