summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/analyzer/errors
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-09-21 11:14:28 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-09-21 11:25:59 +0300
commit3c35e7f1d6ff3aaed360afca3ba1638ec4335aec (patch)
treeffb9b54015afe043893e99b85ceeb8bbcc6b232c /modules/gdscript/tests/scripts/analyzer/errors
parent59139df16e7a10c3b9176f697d23b557af46601e (diff)
downloadredot-engine-3c35e7f1d6ff3aaed360afca3ba1638ec4335aec.tar.gz
GDScript: Make array literal typed if `for` loop variable type is specified
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/errors')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.out2
2 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.gd b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.gd
new file mode 100644
index 0000000000..db3f3f4c72
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.gd
@@ -0,0 +1,5 @@
+# GH-82021
+
+func test():
+ for x: String in [1, 2, 3]:
+ print(x)
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.out b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.out
new file mode 100644
index 0000000000..0bb654e7e2
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/for_loop_wrong_specified_type_with_literal_array.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot include a value of type "int" as "String".