From 04d0e851eae29cb0205ef4f820466a0d9d68d8a1 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 10 Jan 2023 20:01:11 -0300 Subject: GDScript: Fix use of conversion assign for variant values --- .../runtime/features/use_conversion_assign_with_variant_value.gd | 9 +++++++++ .../features/use_conversion_assign_with_variant_value.out | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.out (limited to 'modules/gdscript/tests/scripts/runtime/features') diff --git a/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd new file mode 100644 index 0000000000..af3f3cb941 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd @@ -0,0 +1,9 @@ +# https://github.com/godotengine/godot/issues/71172 + +func test(): + @warning_ignore(narrowing_conversion) + var foo: int = 0.0 + print(typeof(foo) == TYPE_INT) + var dict : Dictionary = {"a":0.0} + foo = dict.get("a") + print(typeof(foo) == TYPE_INT) diff --git a/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.out b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.out new file mode 100644 index 0000000000..9d111a8322 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.out @@ -0,0 +1,3 @@ +GDTEST_OK +true +true -- cgit v1.2.3