mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
go/types, types2: ensure we have a fully resolved type in validType
This addresses a situation where Named.fromRHS is nil which is causing validType to panic when the debug flag is set. Change-Id: Ie1af3f4d412efc2ce2ee7707af5375ed130a1f2a Reviewed-on: https://go-review.googlesource.com/c/go/+/393436 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
5df3f491ac
commit
7751883379
|
@ -63,7 +63,8 @@ func (check *Checker) validType0(typ Type, env *tparamEnv, path []Object) typeIn
|
|||
case *Named:
|
||||
// Don't report a 2nd error if we already know the type is invalid
|
||||
// (e.g., if a cycle was detected earlier, via under).
|
||||
if t.underlying == Typ[Invalid] {
|
||||
// Note: ensure that t.orig is fully resolved by calling Underlying().
|
||||
if t.Underlying() == Typ[Invalid] {
|
||||
check.infoMap[t] = invalid
|
||||
return invalid
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ func (check *Checker) validType0(typ Type, env *tparamEnv, path []Object) typeIn
|
|||
|
||||
case *Named:
|
||||
// Don't report a 2nd error if we already know the type is invalid
|
||||
// (e.g., if a cycle was detected earlier, via under).
|
||||
if t.underlying == Typ[Invalid] {
|
||||
// Note: ensure that t.orig is fully resolved by calling Underlying().
|
||||
if t.Underlying() == Typ[Invalid] {
|
||||
check.infoMap[t] = invalid
|
||||
return invalid
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue