1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

GDScript: Fix missing warning for shadowing of built-in types

This commit is contained in:
Dmitrii Maganov
2023-03-08 22:06:29 +02:00
parent 550a779851
commit 703274fd04
4 changed files with 54 additions and 14 deletions

View File

@@ -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')

View File

@@ -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