[dev.go2go] go/types: add internal TODO for future simplification

Change-Id: I8e4e8eebf8c64962ccf5f0e225dd007f691c373a
Reviewed-on: https://go-review.googlesource.com/c/go/+/239384
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Robert Griesemer 2020-06-22 16:45:13 -07:00
parent dfb538cec8
commit 6ca930a00a
1 changed files with 8 additions and 0 deletions

View File

@ -513,6 +513,9 @@ func (check *Checker) convertUntyped(x *operand, target Type) {
// In case of a type parameter, conversion must succeed against
// all types enumerated by the type parameter bound.
// TODO(gri) We should not need this because we have the code
// for Sum types in convertUntypedInternal. But at least one
// test fails. Investigate.
if t := target.TypeParam(); t != nil {
types := t.Bound().allTypes
if types == nil {
@ -585,6 +588,11 @@ func (check *Checker) convertUntypedInternal(x *operand, target Type) {
goto Error
}
}
case *Sum:
t.is(func(t Type) bool {
check.convertUntypedInternal(x, t)
return x.mode != invalid
})
case *Interface:
// Update operand types to the default type rather then
// the target (interface) type: values must have concrete