diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go index ef86b43ec0..51193f2b41 100644 --- a/src/go/types/predicates.go +++ b/src/go/types/predicates.go @@ -15,7 +15,7 @@ import ( // isNamed may be called with types that are not fully set up. func isNamed(typ Type) bool { switch typ.(type) { - case *Basic, *Named, *instance: + case *Basic, *Named, *TypeParam, *instance: return true } return false diff --git a/src/go/types/testdata/issues.go2 b/src/go/types/testdata/issues.go2 index fca1e88f74..53b7152237 100644 --- a/src/go/types/testdata/issues.go2 +++ b/src/go/types/testdata/issues.go2 @@ -181,13 +181,13 @@ func at(type T interface{ type []E }, E interface{})(x T, i int) E { } // A generic type inside a function acts like a named type. Its underlying -// type is defined by the type list in the tybe bound, if any. +// type is itself, its "operational type" is defined by the type list in +// the tybe bound, if any. func _(type T interface{type int})(x T) { type myint int - var _ int = x + var _ int = int(x) var _ T = 42 - var _ T = int(42) - var _ T = myint(42) + var _ T = T(myint(42)) } // Indexing a generic type with an array type bound checks length.