diff options
author | George Marques <george@gmarqu.es> | 2022-12-30 16:38:35 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 16:38:35 -0300 |
commit | 8a98110e3e353a9a3b86b4a0bd56adf405bd6d93 (patch) | |
tree | c4d0f533e59d049779f772a92ded38065aee46c4 /modules/gdscript/tests | |
parent | 33afa82fb012b92cb24d2af54d871b417c1232fb (diff) | |
parent | bbb21c3fd57af58f458b73fce16f2754e6408a53 (diff) |
Merge pull request #62688 from cdemirer/assignments-and-types
Fixes https://github.com/godotengine/godot/issues/62650
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/typed_assignment.gd | 9 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/typed_assignment.out | 12 |
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 |