diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-04-25 16:17:02 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-04-25 16:17:02 +0200 |
commit | 45cd5dcad39274da18440d6ea3c2121bec248eaa (patch) | |
tree | a750774d0366761fea401da3a3a74123e6c34a46 /modules/gdscript/tests | |
parent | efb42c3101a12120fb85ea6b5a1c03192591b152 (diff) | |
parent | e5365da03ca9dbd52b686174ff2defa0eca62803 (diff) | |
download | redot-engine-45cd5dcad39274da18440d6ea3c2121bec248eaa.tar.gz |
Merge pull request #75885 from AThousandShips/compound_fix
[GDScript] Fix incorrect compound assignment
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/assign_operator.gd | 31 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/assign_operator.out | 6 |
2 files changed, 37 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/assign_operator.gd b/modules/gdscript/tests/scripts/runtime/features/assign_operator.gd new file mode 100644 index 0000000000..2a9fe851ef --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/assign_operator.gd @@ -0,0 +1,31 @@ +# https://github.com/godotengine/godot/issues/75832 + +@warning_ignore("narrowing_conversion") +func test(): + var hf := 2.0 + var sf = 2.0 + + var i := 2 + i *= hf + i *= sf + i *= 2.0 + print(i) + var v2 := Vector2i(1, 2) + v2 *= hf + v2 *= sf + v2 *= 2.0 + print(v2) + var v3 := Vector3i(1, 2, 3) + v3 *= hf + v3 *= sf + v3 *= 2.0 + print(v3) + var v4 := Vector4i(1, 2, 3, 4) + v4 *= hf + v4 *= sf + v4 *= 2.0 + print(v4) + + var arr := [1, 2, 3] + arr += [4, 5] + print(arr) diff --git a/modules/gdscript/tests/scripts/runtime/features/assign_operator.out b/modules/gdscript/tests/scripts/runtime/features/assign_operator.out new file mode 100644 index 0000000000..bfcfc1dff5 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/assign_operator.out @@ -0,0 +1,6 @@ +GDTEST_OK +16 +(8, 16) +(8, 16, 24) +(8, 16, 24, 32) +[1, 2, 3, 4, 5] |