summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/runtime
diff options
context:
space:
mode:
authorcdemirer <41021322+cdemirer@users.noreply.github.com>2022-07-04 01:10:16 +0300
committercdemirer <41021322+cdemirer@users.noreply.github.com>2022-12-25 17:11:30 +0300
commitbbb21c3fd57af58f458b73fce16f2754e6408a53 (patch)
tree3662eaf65640a260de217db912b14a2e7d948265 /modules/gdscript/tests/scripts/runtime
parentf382a2b59bb9606f958ccaf7be7ac98f45607c9f (diff)
Fix type adjustment skipped when value is considered both not hard and not variant
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/typed_assignment.gd9
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/typed_assignment.out12
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_assignment.gd b/modules/gdscript/tests/scripts/runtime/features/typed_assignment.gd
new file mode 100644
index 0000000000..22e54cf91c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/typed_assignment.gd
@@ -0,0 +1,9 @@
+func test():
+ var x: int = 2
+ var y = 3.14
+ var z := 2.72
+ print(typeof(x))
+ x = y
+ print(typeof(x))
+ x = z
+ print(typeof(x))
diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_assignment.out b/modules/gdscript/tests/scripts/runtime/features/typed_assignment.out
new file mode 100644
index 0000000000..4a268dd8e0
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/typed_assignment.out
@@ -0,0 +1,12 @@
+GDTEST_OK
+>> WARNING
+>> Line: 6
+>> NARROWING_CONVERSION
+>> Narrowing conversion (float is converted to int and loses precision).
+>> WARNING
+>> Line: 8
+>> NARROWING_CONVERSION
+>> Narrowing conversion (float is converted to int and loses precision).
+2
+2
+2