mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
Revert "Getting DeepEqual to work with maps whose key is an interface (#4360)"
This reverts commit 1fd75ffbda.
The change is not correct and allows code to continue while it should
panic. For details, see:
https://github.com/tinygo-org/tinygo/pull/4360#issuecomment-2252943012
This commit is contained in:
@@ -982,9 +982,7 @@ func (v Value) MapIndex(key Value) Value {
|
||||
vkey := v.typecode.key()
|
||||
|
||||
// compare key type with actual key type of map
|
||||
// AssignableTo is not implemented for interfaces
|
||||
// avoid: "reflect: unimplemented: AssignableTo with interface"
|
||||
if vkey.Kind() != Interface && !key.typecode.AssignableTo(vkey) {
|
||||
if !key.typecode.AssignableTo(vkey) {
|
||||
// type error?
|
||||
panic("reflect.Value.MapIndex: incompatible types for key")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user