Merge pull request #75419 from vonagam/fix-super-classes-in-array-literals

GDScript: Allow elements of a parent class in a typed array literal
This commit is contained in:
Rémi Verschelde 2023-06-14 09:23:32 +02:00
commit 8b62c52d1c
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 20 additions and 2 deletions

View file

@ -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')

View file

@ -0,0 +1,7 @@
GDTEST_RUNTIME_ERROR
>> ERROR
>> on function: assign()
>> core/variant/array.cpp
>> 222
>> Method/function failed.
not ok