1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Fix for not being able to ignore shadowing warnings on class scope

This commit is contained in:
jpcerrone
2023-04-03 10:57:41 -03:00
parent 91258e52be
commit 13c73500ab
7 changed files with 41 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
extends Node
@onready var shorthand = $Node
@onready var call = get_node(^"Node")
@onready var call_no_cast = get_node(^"Node")
@onready var shorthand_with_cast = $Node as Node
@onready var call_with_cast = get_node(^"Node") as Node
@@ -13,6 +13,6 @@ func _init():
func test():
# Those are expected to be `null` since `_ready()` is never called on tests.
prints("shorthand", shorthand)
prints("call", call)
prints("call_no_cast", call_no_cast)
prints("shorthand_with_cast", shorthand_with_cast)
prints("call_with_cast", call_with_cast)

View File

@@ -1,5 +1,5 @@
GDTEST_OK
shorthand <null>
call <null>
call_no_cast <null>
shorthand_with_cast <null>
call_with_cast <null>

View File

@@ -1,5 +1,9 @@
var member: int = 0
var print_debug := 'print_debug'
@warning_ignore("shadowed_global_identifier")
var print := 'print'
@warning_ignore("unused_variable")
func test():
var Array := 'Array'

View File

@@ -1,26 +1,30 @@
GDTEST_OK
>> WARNING
>> Line: 5
>> Line: 3
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "print_debug" has the same name as a built-in function.
>> WARNING
>> Line: 9
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "Array" has the same name as a built-in type.
>> WARNING
>> Line: 6
>> Line: 10
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "Node" has the same name as a global class.
>> WARNING
>> Line: 7
>> Line: 11
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "is_same" has the same name as a built-in function.
>> WARNING
>> Line: 8
>> Line: 12
>> SHADOWED_GLOBAL_IDENTIFIER
>> The variable "sqrt" has the same name as a built-in function.
>> WARNING
>> Line: 9
>> Line: 13
>> SHADOWED_VARIABLE
>> The local variable "member" is shadowing an already-declared variable at line 1.
>> WARNING
>> Line: 10
>> Line: 14
>> SHADOWED_VARIABLE_BASE_CLASS
>> The local variable "reference" is shadowing an already-declared method at the base class "RefCounted".
warn