1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:07:59 -07:00

cmd/compile/internal/types2: use the underlying TypeParam in

assignableTo

In CL 338310, assignableTo was altered to walk the constituent types of
TypeParams rather than Unions, but was not also adjusted to use under
rather than optype. This manifested in the port to go/types.

Change-Id: Ie057b96ce93cef204af88b536ea49344c9bc8f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/342409
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Robert Findley 2021-08-15 19:47:08 -04:00
parent d043c8ea89
commit c88e3ff648

View File

@ -273,7 +273,7 @@ func (x *operand) assignableTo(check *Checker, T Type, reason *string) (bool, er
// x is an untyped value representable by a value of type T.
if isUntyped(Vu) {
if t, ok := Tu.(*TypeParam); ok {
if t, ok := under(T).(*TypeParam); ok {
return t.is(func(t *term) bool {
// TODO(gri) this could probably be more efficient
if t.tilde {