Browse Source

reflect: SetMapIndex: use AssignableTo() instead of type equality

pull/3604/head
Damian Gryski 2 years ago
committed by Ron Evans
parent
commit
adaa7ca27a
  1. 2
      src/reflect/value.go

2
src/reflect/value.go

@ -1366,7 +1366,7 @@ func (v Value) SetMapIndex(key, elem Value) {
// if elem is the zero Value, it means delete
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")
}

Loading…
Cancel
Save