Skip to content

Commit c1f012a

Browse files
committed
cmd/compile: fix any in -G=0 mode
Fixes go test -gcflags=all=-G=0 -short std, except for the packages with generics in their tests (constraints, encoding/xml), and except for the go/internal/gcimporter and go/types tests, because the compiler does not preserve any in its -G=0 export information. (That's probably acceptable for now.) Fixes cd test/; GO_BUILDER_NAME=longtest go run run.go completely, which should fix the longtest builder. Fixes #50159. Change-Id: I9390972239c18831833edd6530191da2842b876b Reviewed-on: https://go-review.googlesource.com/c/go/+/371715 Trust: Russ Cox <[email protected]> Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 1afa432 commit c1f012a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cmd/compile/internal/types/universe.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func InitTypes(defTypeName func(sym *Sym, typ *Type) Object) {
5757
SimType[et] = et
5858
}
5959

60-
Types[TANY] = newType(TANY)
60+
Types[TANY] = newType(TANY) // note: an old placeholder type, NOT the new builtin 'any' alias for interface{}
6161
Types[TINTER] = NewInterface(LocalPkg, nil, false)
6262
CheckSize(Types[TINTER])
6363

@@ -91,6 +91,7 @@ func InitTypes(defTypeName func(sym *Sym, typ *Type) Object) {
9191
// int32 Hence, (bytetype|runtype).Sym.isAlias() is false.
9292
// TODO(gri) Should we get rid of this special case (at the cost
9393
// of less informative error messages involving bytes and runes)?
94+
// NOTE(rsc): No, the error message quality is important.
9495
// (Alternatively, we could introduce an OTALIAS node representing
9596
// type aliases, albeit at the cost of having to deal with it everywhere).
9697
ByteType = defBasic(TUINT8, BuiltinPkg, "byte")
@@ -111,12 +112,11 @@ func InitTypes(defTypeName func(sym *Sym, typ *Type) Object) {
111112
// any type (interface)
112113
DeferCheckSize()
113114
AnyType = defBasic(TFORW, BuiltinPkg, "any")
114-
AnyType.SetUnderlying(NewInterface(NoPkg, []*Field{}, false))
115+
AnyType.SetUnderlying(NewInterface(BuiltinPkg, []*Field{}, false))
115116
ResumeCheckSize()
116117

117118
if base.Flag.G == 0 {
118119
ComparableType.Sym().Def = nil
119-
AnyType.Sym().Def = nil
120120
}
121121

122122
Types[TUNSAFEPTR] = defBasic(TUNSAFEPTR, UnsafePkg, "Pointer")

0 commit comments

Comments
 (0)