summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/features
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-01-12 20:18:23 +0200
committerDmitrii Maganov <vonagam@gmail.com>2023-01-13 15:36:11 +0200
commit40613ebd21263678ccca63d79bd0853e5d77cca4 (patch)
tree58d7727924f048d0dedcae641d7e081a9ec6af55 /modules/gdscript/tests/scripts/analyzer/features
parent3c9bf4bc210a8e6a208f30ca59de4d4d7e18c04d (diff)
GDScript: Fix typing of iterator in for loop
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/features')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.gd15
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.out4
2 files changed, 19 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.gd b/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.gd
new file mode 100644
index 0000000000..7b74be6f2c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.gd
@@ -0,0 +1,15 @@
+func test():
+ var variant_int: Variant = 1
+ var weak_int = 1
+
+ for x in variant_int:
+ if x is String:
+ print('never')
+ print(x)
+
+ for x in weak_int:
+ if x is String:
+ print('never')
+ print(x)
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.out b/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.out
new file mode 100644
index 0000000000..7677671cfd
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/for_loop_on_variant.out
@@ -0,0 +1,4 @@
+GDTEST_OK
+0
+0
+ok