GDScript: Add static typing for for loop variable
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var a: Array[Node] = []
|
||||
for node: Node in a:
|
||||
print(node)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
GDTEST_OK
|
||||
>> WARNING
|
||||
>> Line: 3
|
||||
>> REDUNDANT_FOR_VARIABLE_TYPE
|
||||
>> The for loop iterator "node" already has inferred type "Node", the specified type is redundant.
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var a: Array[Node2D] = []
|
||||
for node: Node in a:
|
||||
print(node)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
GDTEST_OK
|
||||
>> WARNING
|
||||
>> Line: 3
|
||||
>> REDUNDANT_FOR_VARIABLE_TYPE
|
||||
>> The for loop iterator "node" has inferred type "Node2D" but its supertype "Node" is specified.
|
||||
Reference in New Issue
Block a user