]> Cypherpunks repositories - gostls13.git/commit
reflect: MakeFunc: allow assignment conversions on values returned from the wrapped...
authorKeith Randall <khr@google.com>
Tue, 30 Apr 2019 23:10:43 +0000 (16:10 -0700)
committerKeith Randall <khr@golang.org>
Thu, 2 May 2019 22:17:31 +0000 (22:17 +0000)
commitfe837316519854c7efe2975d75787261ac9fce88
tree94b5db7bbd33f64fc6745d52d9576df25995228e
parentbf35b7c8b15f000e5d816bdb3fa105b0d1df0be5
reflect: MakeFunc: allow assignment conversions on values returned from the wrapped function

Instead of requiring exact type match, allow assignment conversions
(those conversions allowed in the language spec without a cast) on the
returned values.

Particularly useful when the type being returned is an interface type,
but the Value actually returned is a concrete value implementing that
type (as it is tricky to return a Value which has interface type).

RELNOTE=y

Fixes #28761

Change-Id: I69eef07ca51690b2086dfa1eb549db5e4724c657
Reviewed-on: https://go-review.googlesource.com/c/go/+/174531
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/reflect/all_test.go
src/reflect/value.go