GDScript: Add return type covariance and parameter type contravariance
This commit is contained in:
parent
4c3dc26367
commit
cb8b89fd95
19 changed files with 169 additions and 4 deletions
|
|
@ -0,0 +1,20 @@
|
|||
class A:
|
||||
func int_to_variant(_p: int): pass
|
||||
func node_to_variant(_p: Node): pass
|
||||
func node_2d_to_node(_p: Node2D): pass
|
||||
|
||||
func variant_to_untyped(_p: Variant): pass
|
||||
func int_to_untyped(_p: int): pass
|
||||
func node_to_untyped(_p: Node): pass
|
||||
|
||||
class B extends A:
|
||||
func int_to_variant(_p: Variant): pass
|
||||
func node_to_variant(_p: Variant): pass
|
||||
func node_2d_to_node(_p: Node): pass
|
||||
|
||||
func variant_to_untyped(_p): pass
|
||||
func int_to_untyped(_p): pass
|
||||
func node_to_untyped(_p): pass
|
||||
|
||||
func test():
|
||||
pass
|
||||
|
|
@ -0,0 +1 @@
|
|||
GDTEST_OK
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
class A:
|
||||
func variant_to_int() -> Variant: return 0
|
||||
func variant_to_node() -> Variant: return null
|
||||
func node_to_node_2d() -> Node: return null
|
||||
|
||||
func untyped_to_void(): pass
|
||||
func untyped_to_variant(): pass
|
||||
func untyped_to_int(): pass
|
||||
func untyped_to_node(): pass
|
||||
|
||||
func void_to_untyped() -> void: pass
|
||||
func variant_to_untyped() -> Variant: return null
|
||||
func int_to_untyped() -> int: return 0
|
||||
func node_to_untyped() -> Node: return null
|
||||
|
||||
class B extends A:
|
||||
func variant_to_int() -> int: return 0
|
||||
func variant_to_node() -> Node: return null
|
||||
func node_to_node_2d() -> Node2D: return null
|
||||
|
||||
func untyped_to_void() -> void: pass
|
||||
func untyped_to_variant() -> Variant: return null
|
||||
func untyped_to_int() -> int: return 0
|
||||
func untyped_to_node() -> Node: return null
|
||||
|
||||
func void_to_untyped(): pass
|
||||
func variant_to_untyped(): pass
|
||||
func int_to_untyped(): pass
|
||||
func node_to_untyped(): pass
|
||||
|
||||
func test():
|
||||
pass
|
||||
|
|
@ -0,0 +1 @@
|
|||
GDTEST_OK
|
||||
Loading…
Add table
Add a link
Reference in a new issue