• 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
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...