Core: Fix operator[] for typed dictionaries
This commit is contained in:
parent
83d54ab2ad
commit
b3d7960df4
7 changed files with 85 additions and 47 deletions
|
|
@ -0,0 +1,7 @@
|
|||
func get_key() -> Variant:
|
||||
return "key"
|
||||
|
||||
func test():
|
||||
var typed: Dictionary[int, int]
|
||||
typed[get_key()] = 0
|
||||
print('not ok')
|
||||
|
|
@ -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]'.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
func get_value() -> Variant:
|
||||
return "value"
|
||||
|
||||
func test():
|
||||
var typed: Dictionary[int, int]
|
||||
typed[0] = get_value()
|
||||
print("not ok")
|
||||
|
|
@ -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]'.
|
||||
Loading…
Add table
Add a link
Reference in a new issue