GDScript: Add abstract methods

Co-authored-by: ryanabx <ryanbrue@hotmail.com>
This commit is contained in:
Danil Alexeev
2025-05-14 22:52:19 +03:00
parent 8f87e60307
commit a7cf2069d5
27 changed files with 399 additions and 94 deletions

View File

@@ -0,0 +1,28 @@
abstract class AbstractClass:
abstract func some_func()
class ImplementedClass extends AbstractClass:
func some_func():
pass
abstract class AbstractClassAgain extends ImplementedClass:
abstract func some_func()
class Test1:
abstract func some_func()
class Test2 extends AbstractClass:
pass
class Test3 extends AbstractClassAgain:
pass
class Test4 extends AbstractClass:
func some_func():
super()
func other_func():
super.some_func()
func test():
pass

View File

@@ -0,0 +1,6 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 11: Class "Test1" is not abstract but contains abstract methods. Mark the class as abstract or remove "abstract" from all methods in this class.
>> ERROR at line 14: Class "Test2" must implement "AbstractClass.some_func()" and other inherited abstract methods or be marked as abstract.
>> ERROR at line 17: Class "Test3" must implement "AbstractClassAgain.some_func()" and other inherited abstract methods or be marked as abstract.
>> ERROR at line 22: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.
>> ERROR at line 25: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.