mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
Getting DeepEqual to work with maps whose key is an interface (#4360)
reflect: Getting DeepEqual to work with maps whose key is an interface
This commit is contained in:
@@ -982,7 +982,9 @@ func (v Value) MapIndex(key Value) Value {
|
||||
vkey := v.typecode.key()
|
||||
|
||||
// compare key type with actual key type of map
|
||||
if !key.typecode.AssignableTo(vkey) {
|
||||
// AssignableTo is not implemented for interfaces
|
||||
// avoid: "reflect: unimplemented: AssignableTo with interface"
|
||||
if vkey.Kind() != Interface && !key.typecode.AssignableTo(vkey) {
|
||||
// type error?
|
||||
panic("reflect.Value.MapIndex: incompatible types for key")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user