Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GDScript: Fix some issues with assignments that involve untyped things
- Loading branch information
Showing
6 changed files
with
141 additions
and
79 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
3 changes: 3 additions & 0 deletions
3
modules/gdscript/tests/scripts/analyzer/errors/incompatible_assignment.gd
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 @@ | ||
func test(): | ||
var foo: bool = true | ||
foo += 'bar' |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/incompatible_assignment.out
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,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Invalid operands "bool" and "String" for assignment operator. |
19 changes: 19 additions & 0 deletions
19
modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd
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,19 @@ | ||
func test(): | ||
var one_0 = 0 | ||
one_0 = 1 | ||
var one_1 := one_0 | ||
print(one_1) | ||
|
||
var two: Variant = 0 | ||
two += 2 | ||
print(two) | ||
|
||
var three_0: Variant = 1 | ||
var three_1: int = 2 | ||
three_0 += three_1 | ||
print(three_0) | ||
|
||
var four_0: int = 3 | ||
var four_1: Variant = 1 | ||
four_0 += four_1 | ||
print(four_0) |
5 changes: 5 additions & 0 deletions
5
modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out
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,5 @@ | ||
GDTEST_OK | ||
1 | ||
2 | ||
3 | ||
4 |