-
-
Notifications
You must be signed in to change notification settings - Fork 21k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74842 from vonagam/fix-builtin-shadow
GDScript: Fix missing warning for shadowing of built-in types
- Loading branch information
Showing
4 changed files
with
54 additions
and
14 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
12 changes: 12 additions & 0 deletions
12
modules/gdscript/tests/scripts/analyzer/warnings/shadowning.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,12 @@ | ||
var member: int = 0 | ||
|
||
@warning_ignore("unused_variable") | ||
func test(): | ||
var Array := 'Array' | ||
var Node := 'Node' | ||
var is_same := 'is_same' | ||
var sqrt := 'sqrt' | ||
var member := 'member' | ||
var reference := 'reference' | ||
|
||
print('warn') |
26 changes: 26 additions & 0 deletions
26
modules/gdscript/tests/scripts/analyzer/warnings/shadowning.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,26 @@ | ||
GDTEST_OK | ||
>> WARNING | ||
>> Line: 5 | ||
>> SHADOWED_GLOBAL_IDENTIFIER | ||
>> The variable 'Array' has the same name as a built-in type. | ||
>> WARNING | ||
>> Line: 6 | ||
>> SHADOWED_GLOBAL_IDENTIFIER | ||
>> The variable 'Node' has the same name as a global class. | ||
>> WARNING | ||
>> Line: 7 | ||
>> SHADOWED_GLOBAL_IDENTIFIER | ||
>> The variable 'is_same' has the same name as a built-in function. | ||
>> WARNING | ||
>> Line: 8 | ||
>> SHADOWED_GLOBAL_IDENTIFIER | ||
>> The variable 'sqrt' has the same name as a built-in function. | ||
>> WARNING | ||
>> Line: 9 | ||
>> SHADOWED_VARIABLE | ||
>> The local variable "member" is shadowing an already-declared variable at line 1. | ||
>> WARNING | ||
>> Line: 10 | ||
>> SHADOWED_VARIABLE_BASE_CLASS | ||
>> The local variable "reference" is shadowing an already-declared method at the base class "RefCounted". | ||
warn |