Skip to content

Commit e3b48af

Browse files
committed
go/types: remove a review comment in implicitTypeAndValue
This is a clean port of CL 363440 from types2 to go/types. Change-Id: Ibbef41b5b599d5c88f7122670ab87aa5be512c0a Reviewed-on: https://go-review.googlesource.com/c/go/+/364894 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
1 parent 0440fb8 commit e3b48af

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

src/go/types/expr.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -681,16 +681,14 @@ func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, const
681681
return nil, nil, _InvalidUntypedConversion
682682
}
683683
case *TypeParam:
684-
// TODO(gri) review this code - doesn't look quite right
685684
assert(!tparamIsIface)
686-
ok := u.underIs(func(t Type) bool {
687-
if t == nil {
685+
if !u.underIs(func(u Type) bool {
686+
if u == nil {
688687
return false
689688
}
690-
target, _, _ := check.implicitTypeAndValue(x, t)
691-
return target != nil
692-
})
693-
if !ok {
689+
t, _, _ := check.implicitTypeAndValue(x, u)
690+
return t != nil
691+
}) {
694692
return nil, nil, _InvalidUntypedConversion
695693
}
696694
// keep nil untyped (was bug #39755)
@@ -699,15 +697,13 @@ func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, const
699697
}
700698
case *Interface:
701699
if tparamIsIface && isTypeParam(target) {
702-
// TODO(gri) review this code - doesn't look quite right
703-
ok := u.typeSet().underIs(func(t Type) bool {
704-
if t == nil {
700+
if !u.typeSet().underIs(func(u Type) bool {
701+
if u == nil {
705702
return false
706703
}
707-
target, _, _ := check.implicitTypeAndValue(x, t)
708-
return target != nil
709-
})
710-
if !ok {
704+
t, _, _ := check.implicitTypeAndValue(x, u)
705+
return t != nil
706+
}) {
711707
return nil, nil, _InvalidUntypedConversion
712708
}
713709
// keep nil untyped (was bug #39755)

0 commit comments

Comments
 (0)