• Russ Cox's avatar
    reflect: fix interface to interface conversion in Call · eafa29bd
    Russ Cox authored
    Call is meant to mirror the language semantics, which allow:
    
    	var r io.ReadWriter
    	f := func(io.Reader){}
    	f(r)
    
    even though the conversion from io.ReadWriter to io.Reader is
    being applied to a nil interface. This is different from an explicit
    conversion:
    
    	_ = r.(io.Reader)
    	f(r.(io.Reader))
    
    Both of those lines panic, but the implicit conversion does not.
    
    By using E2I, which is the implementation of the explicit conversion,
    the reflect.Call equivalent of f(r) was inadvertently panicking.
    Avoid the panic.
    
    Fixes #22143.
    
    Change-Id: I6b2f5b808e0cd3b89ae8bc75881e307bf1c25558
    Reviewed-on: https://go-review.googlesource.com/80736
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    eafa29bd
Name
Last commit
Last update
..
all_test.go Loading commit data...
asm_386.s Loading commit data...
asm_amd64.s Loading commit data...
asm_amd64p32.s Loading commit data...
asm_arm.s Loading commit data...
asm_arm64.s Loading commit data...
asm_mips64x.s Loading commit data...
asm_mipsx.s Loading commit data...
asm_ppc64x.s Loading commit data...
asm_s390x.s Loading commit data...
deepequal.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
makefunc.go Loading commit data...
set_test.go Loading commit data...
swapper.go Loading commit data...
tostring_test.go Loading commit data...
type.go Loading commit data...
value.go Loading commit data...