-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Typed arrays aren't working with +
- Loading branch information
Showing
4 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
modules/gdscript/tests/scripts/runtime/features/typed_array_concatenation.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# https://github.com/godotengine/godot/issues/72948 | ||
|
||
class Example: | ||
extends RefCounted | ||
|
||
const const_ints : Array[int] = [1, 2, 3] | ||
|
||
func test(): | ||
var ints: Array[int] = [1, 2, 3] | ||
var strings: Array[String] = ["4", "5", "6"] | ||
|
||
var ints_concatenated: Array[int] = ints + ints | ||
var strings_concatenated: Array[String] = strings + strings | ||
var untyped_concatenated: Array = ints + strings | ||
var const_ints_concatenated: Array[int] = const_ints + const_ints | ||
|
||
print(ints_concatenated.get_typed_builtin()) | ||
print(strings_concatenated.get_typed_builtin()) | ||
print(untyped_concatenated.get_typed_builtin()) | ||
print(const_ints_concatenated.get_typed_builtin()) | ||
|
||
var objects: Array[Object] = [] | ||
var objects_concatenated: Array[Object] = objects + objects | ||
print(objects_concatenated.get_typed_class_name()) | ||
|
||
var examples: Array[Example] = [] | ||
var examples_concatenated: Array[Example] = examples + examples | ||
print(examples_concatenated.get_typed_script() == Example) |
7 changes: 7 additions & 0 deletions
7
modules/gdscript/tests/scripts/runtime/features/typed_array_concatenation.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GDTEST_OK | ||
2 | ||
4 | ||
0 | ||
2 | ||
Object | ||
true |