mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
GDScript: Add support for variadic functions
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class A:
|
||||
func f1(x: int, ...args: Array) -> void:
|
||||
prints(x, args)
|
||||
|
||||
func f2(x: int, ...args: Array) -> void:
|
||||
prints(x, args)
|
||||
|
||||
class B extends A:
|
||||
func f1(x: int, y: int, ...args: Array) -> void:
|
||||
prints(x, y, args)
|
||||
|
||||
func f2(x: int) -> void:
|
||||
print(x)
|
||||
|
||||
func g(...args: int):
|
||||
pass
|
||||
|
||||
func h(...args: Array[int]):
|
||||
pass
|
||||
|
||||
func test():
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
>> ERROR at line 15: The rest parameter type must be "Array", but "int" is specified.
|
||||
>> ERROR at line 18: Typed arrays are currently not supported for the rest parameter.
|
||||
>> ERROR at line 9: The function signature doesn't match the parent. Parent signature is "f1(int, ...) -> void".
|
||||
>> ERROR at line 12: The function signature doesn't match the parent. Parent signature is "f2(int, ...) -> void".
|
||||
Reference in New Issue
Block a user