Skip to content

Commit 6ca930a

Browse files
committed
[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 <[email protected]>
1 parent dfb538c commit 6ca930a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/go/types/expr.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,9 @@ func (check *Checker) convertUntyped(x *operand, target Type) {
513513

514514
// In case of a type parameter, conversion must succeed against
515515
// all types enumerated by the type parameter bound.
516+
// TODO(gri) We should not need this because we have the code
517+
// for Sum types in convertUntypedInternal. But at least one
518+
// test fails. Investigate.
516519
if t := target.TypeParam(); t != nil {
517520
types := t.Bound().allTypes
518521
if types == nil {
@@ -585,6 +588,11 @@ func (check *Checker) convertUntypedInternal(x *operand, target Type) {
585588
goto Error
586589
}
587590
}
591+
case *Sum:
592+
t.is(func(t Type) bool {
593+
check.convertUntypedInternal(x, t)
594+
return x.mode != invalid
595+
})
588596
case *Interface:
589597
// Update operand types to the default type rather then
590598
// the target (interface) type: values must have concrete

0 commit comments

Comments
 (0)