diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2023-01-06 06:25:55 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2023-01-06 06:25:55 +0200 |
commit | 10e364bf43a5129220f8091e0bdd00e521ba89ea (patch) | |
tree | b91bed552852192dded3c9826e928659662b77f8 /modules/gdscript/tests | |
parent | 95ce236b7d6a70a06ecc13fb08d48da90ed98430 (diff) |
GDScript: Fix array as default value for parameter
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.gd | 17 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out | 8 |
2 files changed, 25 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.gd b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.gd new file mode 100644 index 0000000000..fc343377fc --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.gd @@ -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') diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out new file mode 100644 index 0000000000..082e3ade19 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out @@ -0,0 +1,8 @@ +GDTEST_OK +[0] +0 +[1] +2 +[2] +2 +ok |