summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/runtime
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-03-28 13:47:24 +0300
committerDmitrii Maganov <vonagam@gmail.com>2023-03-28 13:47:24 +0300
commit8655d979a19bc2c295bd1c41c3fa0e9dba097a0c (patch)
treea9afc788d2fccb18e7ddb1e7da2e1a1aaafa6835 /modules/gdscript/tests/scripts/runtime
parentf818d2b98f33199f480a8f59c8ce1e00876cc834 (diff)
downloadredot-engine-8655d979a19bc2c295bd1c41c3fa0e9dba097a0c.tar.gz
GDScript: Allow elements of a parent class in a typed array literal
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime')
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.gd7
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out7
2 files changed, 14 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.gd b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.gd
new file mode 100644
index 0000000000..83ec6573df
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.gd
@@ -0,0 +1,7 @@
+class Foo: pass
+class Bar extends Foo: pass
+class Baz extends Foo: pass
+
+func test():
+ var typed: Array[Bar] = [Baz.new() as Foo]
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out
new file mode 100644
index 0000000000..a300145266
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out
@@ -0,0 +1,7 @@
+GDTEST_RUNTIME_ERROR
+>> ERROR
+>> on function: assign()
+>> core/variant/array.cpp
+>> 222
+>> Method/function failed.
+not ok