You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Core: Fix operator[] for typed dictionaries
This commit is contained in:
@@ -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]'.
|
||||
Reference in New Issue
Block a user