-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give warning when assigning local to itself. (#875)
Fixes #867.
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
main: | ||
local := 3 | ||
local = local | ||
unresolved | ||
|
||
class A: | ||
field := 499 | ||
|
||
constructor field: | ||
field = field | ||
|
||
method field: | ||
field = field | ||
|
||
static static_method field: | ||
field = field |
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 @@ | ||
tests/negative/assign_self_test.toit:3:9: warning: Assigning local to itself | ||
local = local | ||
^ | ||
tests/negative/assign_self_test.toit:4:3: error: Unresolved identifier: 'unresolved' | ||
unresolved | ||
^~~~~~~~~~ | ||
tests/negative/assign_self_test.toit:10:11: warning: Assigning local to itself has no effect. Did you forget 'this.'? | ||
field = field | ||
^ | ||
tests/negative/assign_self_test.toit:16:11: warning: Assigning local to itself | ||
field = field | ||
^ | ||
tests/negative/assign_self_test.toit:13:11: warning: Assigning local to itself has no effect. Did you forget 'this.'? | ||
field = field | ||
^ | ||
Compilation failed. |