summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/runtime/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/runtime/errors
parent0511f9d9a7d56c742d87fafdcea8785d40ad14b3 (diff)
downloadredot-engine-6c59ed9485bbfadee73a08dfc57224e022626e6e.tar.gz
GDScript: Add static typing for `for` loop variable
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime/errors')
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.out6
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.gd b/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.gd
new file mode 100644
index 0000000000..cdc278ecf5
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.gd
@@ -0,0 +1,4 @@
+func test():
+ var a: Array = [Resource.new()]
+ for node: Node in a:
+ print(node)
diff --git a/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.out b/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.out
new file mode 100644
index 0000000000..b7ef07afb2
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/for_loop_iterator_type_not_match_specified.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: test()
+>> runtime/errors/for_loop_iterator_type_not_match_specified.gd
+>> 3
+>> Trying to assign value of type 'Resource' to a variable of type 'Node'.