Skip to content

Commit 5bb4f49

Browse files
committed
Revert "go/types, types2: track gotypesalias non-default behavior"
This reverts commit c51f6c6. Reason for revert: This breaks toolchain bootstrapping in Google. Root cause investigation is pending. Error message is: ``` <unknown line number>: internal compiler error: panic: godebug: Value of name not listed in godebugs.All: gotypesalias ``` Change-Id: Ie3dff566a29b3b0846ebc8fe0a371c656a043a4c Reviewed-on: https://go-review.googlesource.com/c/go/+/579575 Reviewed-by: Chressie Himpel <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Lasse Folger <[email protected]>
1 parent c51f6c6 commit 5bb4f49

File tree

8 files changed

+4
-40
lines changed

8 files changed

+4
-40
lines changed

src/cmd/compile/internal/types2/check.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ type Checker struct {
102102
// If enableAlias is set, alias declarations produce an Alias type.
103103
// Otherwise the alias information is only in the type name, which
104104
// points directly to the actual (aliased) type.
105-
// Starting with Go 1.23, enableAlias is set by default.
106-
// Non-default behavior is tracked with gotypesalias.IncNonDefault()
107-
// for each declaration of an alias type where enableAlias is not set.
108-
//
109-
// TODO(gri) Testing runs tests in both modes. Do we need to exclude
110-
// tracking of non-default behavior for tests?
111105
enableAlias bool
112106

113107
conf *Config

src/cmd/compile/internal/types2/check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func parseFlags(src []byte, flags *flag.FlagSet) error {
122122
//
123123
// If provided, opts may be used to mutate the Config before type-checking.
124124
func testFiles(t *testing.T, filenames []string, srcs [][]byte, colDelta uint, manual bool, opts ...func(*Config)) {
125-
// Alias types are enabled by default.
125+
// Alias types are enabled by default
126126
testFilesImpl(t, filenames, srcs, colDelta, manual, opts...)
127127
if !manual {
128128
t.Setenv("GODEBUG", "gotypesalias=0")

src/cmd/compile/internal/types2/decl.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -532,22 +532,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *TypeN
532532
alias.fromRHS = rhs
533533
Unalias(alias) // resolve alias.actual
534534
} else {
535-
// With Go1.23, the default behavior is to use Alias nodes,
536-
// reflected by check.enableAlias. Signal non-default behavior
537-
// by calling gotypesalias.IncNonDefault().
538-
//
539-
// Note: As of Go 1.23, Settings.IncNonDefault is not present
540-
// in internal/godebug/godebug.go used during bootstrapping,
541-
// only after the tool chain is built and recompiles itself.
542-
// Check dynamically for the presence of IncNonDefault.
543-
// (This is not an issue for go/types because it is not used
544-
// during bootstrap.)
545-
//
546-
// TODO(gri) replace with direct call when we bootstrap with Go 1.20
547-
if s, ok := any(gotypesalias).(interface{ IncNonDefault() }); ok {
548-
s.IncNonDefault()
549-
}
550-
551535
if !versionErr && tparam0 != nil {
552536
check.error(tdecl, UnsupportedFeature, "generic type alias requires GODEBUG=gotypesalias=1 or unset")
553537
versionErr = true

src/go/types/check.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,9 @@ type Checker struct {
102102
// package information
103103
// (initialized by NewChecker, valid for the life-time of checker)
104104

105-
// If enableAlias is set, alias declarations produce an Alias type.
105+
// If EnableAlias is set, alias declarations produce an Alias type.
106106
// Otherwise the alias information is only in the type name, which
107107
// points directly to the actual (aliased) type.
108-
// Starting with Go 1.23, enableAlias is set by default.
109-
// Non-default behavior is tracked with gotypesalias.IncNonDefault()
110-
// for each declaration of an alias type where enableAlias is not set.
111-
//
112-
// TODO(gri) Testing runs tests in both modes. Do we need to exclude
113-
// tracking of non-default behavior for tests?
114108
enableAlias bool
115109

116110
conf *Config

src/go/types/check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func parseFlags(src []byte, flags *flag.FlagSet) error {
134134
//
135135
// If provided, opts may be used to mutate the Config before type-checking.
136136
func testFiles(t *testing.T, filenames []string, srcs [][]byte, manual bool, opts ...func(*Config)) {
137-
// Alias types are enabled by default.
137+
// Alias types are enabled by default
138138
testFilesImpl(t, filenames, srcs, manual, opts...)
139139
if !manual {
140140
t.Setenv("GODEBUG", "gotypesalias=0")

src/go/types/decl.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *TypeName
607607
alias.fromRHS = rhs
608608
Unalias(alias) // resolve alias.actual
609609
} else {
610-
// With Go1.23, the default behavior is to use Alias nodes,
611-
// reflected by check.enableAlias. Signal non-default behavior.
612-
gotypesalias.IncNonDefault()
613-
614610
if !versionErr && tparam0 != nil {
615611
check.error(tdecl, UnsupportedFeature, "generic type alias requires GODEBUG=gotypesalias=1 or unset")
616612
versionErr = true

src/internal/godebugs/table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var All = []Info{
3030
{Name: "gocachehash", Package: "cmd/go"},
3131
{Name: "gocachetest", Package: "cmd/go"},
3232
{Name: "gocacheverify", Package: "cmd/go"},
33-
{Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0"},
33+
{Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0", Opaque: true}, // bug #66216: remove Opaque
3434
{Name: "http2client", Package: "net/http"},
3535
{Name: "http2debug", Package: "net/http", Opaque: true},
3636
{Name: "http2server", Package: "net/http"},

src/runtime/metrics/doc.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ Below is the full list of supported metrics, ordered lexicographically.
246246
The number of non-default behaviors executed by the cmd/go
247247
package due to a non-default GODEBUG=gocacheverify=... setting.
248248
249-
/godebug/non-default-behavior/gotypesalias:events
250-
The number of non-default behaviors executed by the go/types
251-
package due to a non-default GODEBUG=gotypesalias=... setting.
252-
253249
/godebug/non-default-behavior/http2client:events
254250
The number of non-default behaviors executed by the net/http
255251
package due to a non-default GODEBUG=http2client=... setting.

0 commit comments

Comments
 (0)