summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-22 22:05:34 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-22 22:05:34 +0200
commit1c10ff37b34e557afe0da0bdd6f7ae180201a533 (patch)
treebc76d5dd23f06119c496a083e4b347e635e43700 /modules/gdscript/tests/scripts
parentf795e458680ce5d7879e5556f8606aa96a6832a8 (diff)
parent10b00bc2eaa5d6e49ed68eb5eb832abfdeff5f1a (diff)
downloadredot-engine-1c10ff37b34e557afe0da0bdd6f7ae180201a533.tar.gz
Merge pull request #82098 from dalexeev/gds-prevent-engine-singleton-inheritance
GDScript: Prevent constructing and inheriting engine singletons
Diffstat (limited to 'modules/gdscript/tests/scripts')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out2
4 files changed, 12 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd
new file mode 100644
index 0000000000..7e1efb8d1b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd
@@ -0,0 +1,2 @@
+func test():
+ Time.new()
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out
new file mode 100644
index 0000000000..bc4875d908
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot construct native class "Time" because it is an engine singleton.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd
new file mode 100644
index 0000000000..a46b6d8658
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd
@@ -0,0 +1,6 @@
+# GH-82081
+
+extends Time
+
+func test():
+ pass
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out
new file mode 100644
index 0000000000..7c26dea56e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot inherit native class "Time" because it is an engine singleton.