-
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.
Move AmbiguousNamedTupleAssignment check to Typer
Co-Authored-By: Nicolas Stucki <3648029+nicolasstucki@users.noreply.github.com> Co-Authored-By: Oliver Bračevac <bracevac@users.noreply.github.com>
- Loading branch information
1 parent
8566f53
commit 3dd3494
Showing
5 changed files
with
39 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def test1() = | ||
class Person: | ||
def age: Int = ??? | ||
def age_=(x: Int): Unit = ??? | ||
|
||
val person = Person() | ||
|
||
(person.age = 29) // no warn (interpreted as `person.age_=(29)`) | ||
|
||
def test2() = | ||
class Person: | ||
var age: Int = 28 | ||
|
||
val person = Person() | ||
|
||
(person.age = 29) // no warn (interpreted as `person.age_=(29)`) |
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,7 @@ | ||
-- [E203] Syntax Migration Warning: tests/warn/21681b.scala:3:2 -------------------------------------------------------- | ||
3 | (age = 29) // warn | ||
| ^^^^^^^^^^ | ||
| Ambiguous syntax: this is interpreted as a named tuple with one element, | ||
| not as an assignment. | ||
| | ||
| To assign a value, use curly braces: `{age = 29}`. |
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 @@ | ||
object Test: | ||
var age: Int = 28 | ||
(age = 29) // warn |