summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-03 23:22:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-03 23:22:23 +0100
commit8203e093302fa2c8862dbad7dbade6731468e5e4 (patch)
tree6847c93898b0e42c367db4d8a26c3e8f68b27fec /modules/gdscript/tests/scripts
parent565ae3b76791ba707a5a18be50be336533ef0857 (diff)
parent961b4ac5f5f2279a5ce67341bb89db859ba9d40d (diff)
Merge pull request #70859 from vonagam/fix-preload-native-type
GDScript: Fix wrong native type for preloaded class
Diffstat (limited to 'modules/gdscript/tests/scripts')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.gd15
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.notest.gd1
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/preload_script_native_type.out3
3 files changed, 19 insertions, 0 deletions
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