diff --git a/src/cmd/compile/internal/types2/api_test.go b/src/cmd/compile/internal/types2/api_test.go index 6f65b84f7c2..9d23b5b2a6c 100644 --- a/src/cmd/compile/internal/types2/api_test.go +++ b/src/cmd/compile/internal/types2/api_test.go @@ -323,14 +323,14 @@ func TestTypesInfo(t *testing.T) { {broken + `x5; func _() { var x map[string][...]int; x = map[string][...]int{"": {1,2,3}} }`, `x`, `map[string][-1]int`}, // parameterized functions - {`package p0; func f[T any](T); var _ = f[int]`, `f`, `func[T₁ any](T₁)`}, + {`package p0; func f[T any](T); var _ = f[int]`, `f`, `func[T₁ interface{}](T₁)`}, {`package p1; func f[T any](T); var _ = f[int]`, `f[int]`, `func(int)`}, - {`package p2; func f[T any](T); func _() { f(42) }`, `f`, `func[T₁ any](T₁)`}, + {`package p2; func f[T any](T); func _() { f(42) }`, `f`, `func[T₁ interface{}](T₁)`}, {`package p3; func f[T any](T); func _() { f(42) }`, `f(42)`, `()`}, // type parameters {`package t0; type t[] int; var _ t`, `t`, `t0.t`}, // t[] is a syntax error that is ignored in this test in favor of t - {`package t1; type t[P any] int; var _ t[int]`, `t`, `t1.t[P₁ any]`}, + {`package t1; type t[P any] int; var _ t[int]`, `t`, `t1.t[P₁ interface{}]`}, {`package t2; type t[P interface{}] int; var _ t[int]`, `t`, `t2.t[P₁ interface{}]`}, {`package t3; type t[P, Q interface{}] int; var _ t[int, int]`, `t`, `t3.t[P₁, Q₂ interface{}]`}, {broken + `t4; type t[P, Q interface{ m() }] int; var _ t[int, int]`, `t`, `broken_t4.t[P₁, Q₂ interface{m()}]`}, diff --git a/src/cmd/compile/internal/types2/universe.go b/src/cmd/compile/internal/types2/universe.go index c1961d74553..f3dd53af1f0 100644 --- a/src/cmd/compile/internal/types2/universe.go +++ b/src/cmd/compile/internal/types2/universe.go @@ -24,7 +24,7 @@ var ( universeIota *Const universeByte *Basic // uint8 alias, but has name "byte" universeRune *Basic // int32 alias, but has name "rune" - universeAny *Named + universeAny *Interface universeError *Named ) @@ -34,7 +34,7 @@ var ( // The *Basic type for Typ[Byte] will have the name "uint8". // Use Universe.Lookup("byte").Type() to obtain the specific // alias basic type named "byte" (and analogous for "rune"). -var Typ = []*Basic{ +var Typ = [...]*Basic{ Invalid: {Invalid, 0, "invalid type", aType{}}, Bool: {Bool, IsBoolean, "bool", aType{}}, @@ -82,10 +82,7 @@ func defPredeclaredTypes() { // (Predeclared and entered into universe scope so we do all the // usual checks; but removed again from scope later since it's // only visible as constraint in a type parameter list.) - { - typ := &Named{underlying: &emptyInterface} - def(NewTypeName(nopos, nil, "any", typ)) - } + def(NewTypeName(nopos, nil, "any", &emptyInterface)) // Error has a nil package in its qualified name since it is in no package { @@ -241,7 +238,7 @@ func init() { universeIota = Universe.Lookup("iota").(*Const) universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic) universeRune = Universe.Lookup("rune").(*TypeName).typ.(*Basic) - universeAny = Universe.Lookup("any").(*TypeName).typ.(*Named) + universeAny = Universe.Lookup("any").(*TypeName).typ.(*Interface) universeError = Universe.Lookup("error").(*TypeName).typ.(*Named) // "any" is only visible as constraint in a type parameter list