forked from cerc-io/plugeth
accounts/abi: fix set function (#25477)
* accounts/abi: fix set function * don't break things * update test
This commit is contained in:
parent
36874b63a1
commit
0865880626
@ -99,7 +99,7 @@ func mustArrayToByteSlice(value reflect.Value) reflect.Value {
|
|||||||
func set(dst, src reflect.Value) error {
|
func set(dst, src reflect.Value) error {
|
||||||
dstType, srcType := dst.Type(), src.Type()
|
dstType, srcType := dst.Type(), src.Type()
|
||||||
switch {
|
switch {
|
||||||
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid():
|
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()):
|
||||||
return set(dst.Elem(), src)
|
return set(dst.Elem(), src)
|
||||||
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}):
|
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}):
|
||||||
return set(dst.Elem(), src)
|
return set(dst.Elem(), src)
|
||||||
|
@ -352,6 +352,11 @@ func TestMethodMultiReturn(t *testing.T) {
|
|||||||
&[]interface{}{&expected.Int, &expected.String},
|
&[]interface{}{&expected.Int, &expected.String},
|
||||||
"",
|
"",
|
||||||
"Can unpack into a slice",
|
"Can unpack into a slice",
|
||||||
|
}, {
|
||||||
|
&[]interface{}{&bigint, ""},
|
||||||
|
&[]interface{}{&expected.Int, expected.String},
|
||||||
|
"",
|
||||||
|
"Can unpack into a slice without indirection",
|
||||||
}, {
|
}, {
|
||||||
&[2]interface{}{&bigint, new(string)},
|
&[2]interface{}{&bigint, new(string)},
|
||||||
&[2]interface{}{&expected.Int, &expected.String},
|
&[2]interface{}{&expected.Int, &expected.String},
|
||||||
|
Loading…
Reference in New Issue
Block a user