GDScript: Fix extending abstract classes, forbid their construction
This commit is contained in:
parent
e80cf3259e
commit
274d49790d
8 changed files with 54 additions and 12 deletions
|
|
@ -0,0 +1,2 @@
|
|||
func test():
|
||||
CanvasItem.new()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Native class "CanvasItem" cannot be constructed as it is abstract.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
class A extends CanvasItem:
|
||||
func _init():
|
||||
print('no')
|
||||
|
||||
class B extends A:
|
||||
pass
|
||||
|
||||
func test():
|
||||
B.new()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Class "abstract_script_instantiate.gd::B" cannot be constructed as it is based on abstract native class "CanvasItem".
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
class A extends CanvasItem:
|
||||
func _init():
|
||||
pass
|
||||
|
||||
class B extends A:
|
||||
pass
|
||||
|
||||
class C extends CanvasItem:
|
||||
pass
|
||||
|
||||
func test():
|
||||
print('ok')
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_OK
|
||||
ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue