From 6c59ed9485bbfadee73a08dfc57224e022626e6e Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Fri, 4 Aug 2023 12:19:11 +0300 Subject: GDScript: Add static typing for `for` loop variable --- .../tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd | 4 ++++ .../tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type.out (limited to 'modules/gdscript/tests/scripts/analyzer/errors') 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". -- cgit v1.2.3