mirror of
https://github.com/golang/go
synced 2024-11-17 18:44:44 -07:00
cmd/compile/internal/types2: remove a review comment in implicitTypeAndValue
Reviewed the code and simplified slightly. No semantic changes. Change-Id: Ib785b912fbee97746324af87ac0c14a4bdb69477 Reviewed-on: https://go-review.googlesource.com/c/go/+/363440 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
c09d854f09
commit
56e55a3889
@ -742,29 +742,25 @@ func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, const
|
||||
return nil, nil, _InvalidUntypedConversion
|
||||
}
|
||||
case *TypeParam:
|
||||
// TODO(gri) review this code - doesn't look quite right
|
||||
assert(!tparamIsIface)
|
||||
ok := u.underIs(func(t Type) bool {
|
||||
if t == nil {
|
||||
if !u.underIs(func(u Type) bool {
|
||||
if u == nil {
|
||||
return false
|
||||
}
|
||||
target, _, _ := check.implicitTypeAndValue(x, t)
|
||||
return target != nil
|
||||
})
|
||||
if !ok {
|
||||
t, _, _ := check.implicitTypeAndValue(x, u)
|
||||
return t != nil
|
||||
}) {
|
||||
return nil, nil, _InvalidUntypedConversion
|
||||
}
|
||||
case *Interface:
|
||||
if tparamIsIface && isTypeParam(target) {
|
||||
// TODO(gri) review this code - doesn't look quite right
|
||||
ok := u.typeSet().underIs(func(t Type) bool {
|
||||
if t == nil {
|
||||
if !u.typeSet().underIs(func(u Type) bool {
|
||||
if u == nil {
|
||||
return false
|
||||
}
|
||||
target, _, _ := check.implicitTypeAndValue(x, t)
|
||||
return target != nil
|
||||
})
|
||||
if !ok {
|
||||
t, _, _ := check.implicitTypeAndValue(x, u)
|
||||
return t != nil
|
||||
}) {
|
||||
return nil, nil, _InvalidUntypedConversion
|
||||
}
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user