mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-22 13:29:01 +00:00
reflect: SetMapIndex: use AssignableTo() instead of type equality
This commit is contained in:
@@ -1366,7 +1366,7 @@ func (v Value) SetMapIndex(key, elem Value) {
|
|||||||
// if elem is the zero Value, it means delete
|
// if elem is the zero Value, it means delete
|
||||||
del := elem == Value{}
|
del := elem == Value{}
|
||||||
|
|
||||||
if !del && elem.typecode != v.typecode.elem() {
|
if !del && !elem.typecode.AssignableTo(v.typecode.elem()) {
|
||||||
panic("reflect.Value.SetMapIndex: incompatible types for value")
|
panic("reflect.Value.SetMapIndex: incompatible types for value")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user