summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/analyzer/errors
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-08-04 12:19:11 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-08-17 20:54:34 +0300
commit6c59ed9485bbfadee73a08dfc57224e022626e6e (patch)
treea1a08f3636453e10a09fed1e8a057f63f0e35303 /modules/gdscript/tests/scripts/analyzer/errors
parent0511f9d9a7d56c742d87fafdcea8785d40ad14b3 (diff)
downloadredot-engine-6c59ed9485bbfadee73a08dfc57224e022626e6e.tar.gz
GDScript: Add static typing for `for` loop variable
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/errors')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd4
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out2
2 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd
new file mode 100644
index 0000000000..7e3b6e3c39
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd
@@ -0,0 +1,4 @@
+func test():
+ var a: Array[Resource] = []
+ for node: Node in a:
+ print(node)
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out
new file mode 100644
index 0000000000..8f8a368f9a
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Unable to iterate on value of type "Array[Resource]" with variable of type "Node".