]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/types2/validtype.go
go/types, types2: implement Alias proposal (export API)
[gostls13.git] / src / cmd / compile / internal / types2 / validtype.go
index b0ebc025608cc82285b1e7a39772e51ebbfa597e..a880a3d93320123f3e62b9569c57990dad80f022 100644 (file)
@@ -23,7 +23,7 @@ func (check *Checker) validType(typ *Named) {
 // (say S->F->S) we have an invalid recursive type. The path list is the full
 // path of named types in a cycle, it is only needed for error reporting.
 func (check *Checker) validType0(typ Type, nest, path []*Named) bool {
-       switch t := typ.(type) {
+       switch t := Unalias(typ).(type) {
        case nil:
                // We should never see a nil type but be conservative and panic
                // only in debug mode.
@@ -68,7 +68,7 @@ func (check *Checker) validType0(typ Type, nest, path []*Named) bool {
                // Don't report a 2nd error if we already know the type is invalid
                // (e.g., if a cycle was detected earlier, via under).
                // Note: ensure that t.orig is fully resolved by calling Underlying().
-               if t.Underlying() == Typ[Invalid] {
+               if !isValid(t.Underlying()) {
                        return false
                }
 
@@ -198,7 +198,7 @@ func makeObjList(tlist []*Named) []Object {
 //         nest = A[A[string]]->B[P]
 //         path = A[A[string]]->B[P]
 //
-// Eventutally we reach the type parameter P of type B (P₂):
+// Eventually we reach the type parameter P of type B (P₂):
 //
 //   P₂
 //         nest = A[A[string]]->B[P]