summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/errors
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-02-01 14:52:18 +0200
committerDmitrii Maganov <vonagam@gmail.com>2023-02-01 14:52:29 +0200
commit1a810ff45ebda061c2f41249eca1c8df9b5991e8 (patch)
tree00ad35ebff068aaca3c290183b01e33306c0bf9a /modules/gdscript/tests/scripts/analyzer/errors
parent0a9e6e478e3183d7bf3c5cb895c706bc6275d3ea (diff)
GDScript: Fix type certainty for result of ternary operator
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/errors')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.out2
2 files changed, 8 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.gd b/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.gd
new file mode 100644
index 0000000000..fac0e8756c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.gd
@@ -0,0 +1,6 @@
+func test():
+ var left_hard_int := 1
+ var right_weak_int = 2
+ var result_hm_int := left_hard_int if true else right_weak_int
+
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.out b/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.out
new file mode 100644
index 0000000000..71d1e2f8ae
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/ternary_weak_infer.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot infer the type of "result_hm_int" variable because the value doesn't have a set type.