-
-
Notifications
You must be signed in to change notification settings - Fork 21k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Fix
operator[]
for typed dictionaries
- Loading branch information
Showing
7 changed files
with
83 additions
and
44 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
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
7 changes: 7 additions & 0 deletions
7
...es/gdscript/tests/scripts/runtime/errors/typed_dictionary_assign_differently_typed_key.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,7 @@ | ||
func get_key() -> Variant: | ||
return "key" | ||
|
||
func test(): | ||
var typed: Dictionary[int, int] | ||
typed[get_key()] = 0 | ||
print('not ok') |
6 changes: 6 additions & 0 deletions
6
...s/gdscript/tests/scripts/runtime/errors/typed_dictionary_assign_differently_typed_key.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,6 @@ | ||
GDTEST_RUNTIME_ERROR | ||
>> SCRIPT ERROR | ||
>> on function: test() | ||
>> runtime/errors/typed_dictionary_assign_differently_typed_key.gd | ||
>> 6 | ||
>> Invalid assignment of property or key 'key' with value of type 'int' on a base object of type 'Dictionary[int, int]'. |
7 changes: 7 additions & 0 deletions
7
.../gdscript/tests/scripts/runtime/errors/typed_dictionary_assign_differently_typed_value.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,7 @@ | ||
func get_value() -> Variant: | ||
return "value" | ||
|
||
func test(): | ||
var typed: Dictionary[int, int] | ||
typed[0] = get_value() | ||
print("not ok") |
6 changes: 6 additions & 0 deletions
6
...gdscript/tests/scripts/runtime/errors/typed_dictionary_assign_differently_typed_value.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,6 @@ | ||
GDTEST_RUNTIME_ERROR | ||
>> SCRIPT ERROR | ||
>> on function: test() | ||
>> runtime/errors/typed_dictionary_assign_differently_typed_value.gd | ||
>> 6 | ||
>> Invalid assignment of property or key '0' with value of type 'String' on a base object of type 'Dictionary[int, int]'. |