mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
GDScript: Fix array as default value for parameter
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
func print_untyped(array = [0]) -> void:
|
||||
print(array)
|
||||
print(array.get_typed_builtin())
|
||||
|
||||
func print_inferred(array := [1]) -> void:
|
||||
print(array)
|
||||
print(array.get_typed_builtin())
|
||||
|
||||
func print_typed(array: Array[int] = [2]) -> void:
|
||||
print(array)
|
||||
print(array.get_typed_builtin())
|
||||
|
||||
func test():
|
||||
print_untyped()
|
||||
print_inferred()
|
||||
print_typed()
|
||||
print('ok')
|
||||
@@ -0,0 +1,8 @@
|
||||
GDTEST_OK
|
||||
[0]
|
||||
0
|
||||
[1]
|
||||
2
|
||||
[2]
|
||||
2
|
||||
ok
|
||||
Reference in New Issue
Block a user