From 961b4ac5f5f2279a5ce67341bb89db859ba9d40d Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Tue, 3 Jan 2023 04:54:51 +0200 Subject: GDScript: Fix wrong native type for preloaded class --- .../analyzer/features/preload_script_native_type.gd | 15 +++++++++++++++ .../features/preload_script_native_type.notest.gd | 1 + .../analyzer/features/preload_script_native_type.out | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.notest.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.out (limited to 'modules/gdscript/tests/scripts') diff --git a/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.gd b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.gd new file mode 100644 index 0000000000..25381035b2 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.gd @@ -0,0 +1,15 @@ +const Preloaded := preload( 'preload_script_native_type.notest.gd' ) + +func test() -> void: + var inferred := Preloaded.new() + var inferred_owner := inferred.owner + + var typed: Preloaded + typed = Preloaded.new() + var typed_owner := typed.owner + + print(typed_owner == inferred_owner) + + inferred.free() + typed.free() + print('ok') diff --git a/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.notest.gd b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.notest.gd new file mode 100644 index 0000000000..61510e14cd --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.notest.gd @@ -0,0 +1 @@ +extends Node diff --git a/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.out b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.out new file mode 100644 index 0000000000..3e24a1e2af --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.out @@ -0,0 +1,3 @@ +GDTEST_OK +true +ok -- cgit v1.2.3