]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/validtype.go
go/types, types2: implement Alias proposal (export API)
[gostls13.git] / src / go / types / validtype.go
index d915fef825516bad9d356fad2d66d41c1eb54d15..063871485732eb1ba67e0f22b8dacfc24e612e39 100644 (file)
@@ -25,7 +25,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.
@@ -70,7 +70,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
                }