Inherit parent method return types for untyped overrides
This commit is contained in:
parent
f4f0679a2d
commit
058a46f154
11 changed files with 93 additions and 9 deletions
|
|
@ -0,0 +1,14 @@
|
|||
class A:
|
||||
func return_void() -> void: pass
|
||||
func return_int() -> int: return 123
|
||||
func return_node(_resource: Resource) -> Node: return null
|
||||
func return_variant() -> Variant: return null
|
||||
|
||||
class B extends A:
|
||||
func return_void(): return 1
|
||||
func return_int(): return "abc"
|
||||
func return_node(resource: Resource): return resource
|
||||
func return_variant(): pass
|
||||
|
||||
func test():
|
||||
pass
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
>> ERROR at line 8: A void function cannot return a value.
|
||||
>> ERROR at line 9: Cannot return a value of type "String" as "int".
|
||||
>> ERROR at line 9: Cannot return value of type "String" because the function return type is "int".
|
||||
>> ERROR at line 10: Cannot return value of type "Resource" because the function return type is "Node".
|
||||
>> ERROR at line 11: Not all code paths return a value.
|
||||
Loading…
Add table
Add a link
Reference in a new issue