aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Folger <lassefolger@google.com>2024-04-17 13:30:58 +0000
committerLasse Folger <lassefolger@google.com>2024-04-17 14:04:17 +0000
commit5bb4f4947158311255583ff2d6acd427ac2cb0d8 (patch)
tree119d074fcee14d2e46c3b2513f97cc7a6d208c92 /src
parentc51f6c62576ab3088a981b9cef90e413ac99e333 (diff)
downloadgo-5bb4f4947158311255583ff2d6acd427ac2cb0d8.tar.xz
Revert "go/types, types2: track gotypesalias non-default behavior"
This reverts commit c51f6c62576ab3088a981b9cef90e413ac99e333. 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 <chressie@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Lasse Folger <lassefolger@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/types2/check.go6
-rw-r--r--src/cmd/compile/internal/types2/check_test.go2
-rw-r--r--src/cmd/compile/internal/types2/decl.go16
-rw-r--r--src/go/types/check.go8
-rw-r--r--src/go/types/check_test.go2
-rw-r--r--src/go/types/decl.go4
-rw-r--r--src/internal/godebugs/table.go2
-rw-r--r--src/runtime/metrics/doc.go4
8 files changed, 4 insertions, 40 deletions
diff --git a/src/cmd/compile/internal/types2/check.go b/src/cmd/compile/internal/types2/check.go
index 17d1577ee1..cc723f2012 100644
--- a/src/cmd/compile/internal/types2/check.go
+++ b/src/cmd/compile/internal/types2/check.go
@@ -102,12 +102,6 @@ type Checker struct {
// If enableAlias is set, alias declarations produce an Alias type.
// Otherwise the alias information is only in the type name, which
// points directly to the actual (aliased) type.
- // Starting with Go 1.23, enableAlias is set by default.
- // Non-default behavior is tracked with gotypesalias.IncNonDefault()
- // for each declaration of an alias type where enableAlias is not set.
- //
- // TODO(gri) Testing runs tests in both modes. Do we need to exclude
- // tracking of non-default behavior for tests?
enableAlias bool
conf *Config
diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go
index f1b520d33c..066218772e 100644
--- a/src/cmd/compile/internal/types2/check_test.go
+++ b/src/cmd/compile/internal/types2/check_test.go
@@ -122,7 +122,7 @@ func parseFlags(src []byte, flags *flag.FlagSet) error {
//
// If provided, opts may be used to mutate the Config before type-checking.
func testFiles(t *testing.T, filenames []string, srcs [][]byte, colDelta uint, manual bool, opts ...func(*Config)) {
- // Alias types are enabled by default.
+ // Alias types are enabled by default
testFilesImpl(t, filenames, srcs, colDelta, manual, opts...)
if !manual {
t.Setenv("GODEBUG", "gotypesalias=0")
diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go
index fff2da4953..26ce49d87a 100644
--- a/src/cmd/compile/internal/types2/decl.go
+++ b/src/cmd/compile/internal/types2/decl.go
@@ -532,22 +532,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *TypeN
alias.fromRHS = rhs
Unalias(alias) // resolve alias.actual
} else {
- // With Go1.23, the default behavior is to use Alias nodes,
- // reflected by check.enableAlias. Signal non-default behavior
- // by calling gotypesalias.IncNonDefault().
- //
- // Note: As of Go 1.23, Settings.IncNonDefault is not present
- // in internal/godebug/godebug.go used during bootstrapping,
- // only after the tool chain is built and recompiles itself.
- // Check dynamically for the presence of IncNonDefault.
- // (This is not an issue for go/types because it is not used
- // during bootstrap.)
- //
- // TODO(gri) replace with direct call when we bootstrap with Go 1.20
- if s, ok := any(gotypesalias).(interface{ IncNonDefault() }); ok {
- s.IncNonDefault()
- }
-
if !versionErr && tparam0 != nil {
check.error(tdecl, UnsupportedFeature, "generic type alias requires GODEBUG=gotypesalias=1 or unset")
versionErr = true
diff --git a/src/go/types/check.go b/src/go/types/check.go
index c651e57fa9..be990eabfe 100644
--- a/src/go/types/check.go
+++ b/src/go/types/check.go
@@ -102,15 +102,9 @@ type Checker struct {
// package information
// (initialized by NewChecker, valid for the life-time of checker)
- // If enableAlias is set, alias declarations produce an Alias type.
+ // If EnableAlias is set, alias declarations produce an Alias type.
// Otherwise the alias information is only in the type name, which
// points directly to the actual (aliased) type.
- // Starting with Go 1.23, enableAlias is set by default.
- // Non-default behavior is tracked with gotypesalias.IncNonDefault()
- // for each declaration of an alias type where enableAlias is not set.
- //
- // TODO(gri) Testing runs tests in both modes. Do we need to exclude
- // tracking of non-default behavior for tests?
enableAlias bool
conf *Config
diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go
index 068507dade..6ad7ef3a27 100644
--- a/src/go/types/check_test.go
+++ b/src/go/types/check_test.go
@@ -134,7 +134,7 @@ func parseFlags(src []byte, flags *flag.FlagSet) error {
//
// If provided, opts may be used to mutate the Config before type-checking.
func testFiles(t *testing.T, filenames []string, srcs [][]byte, manual bool, opts ...func(*Config)) {
- // Alias types are enabled by default.
+ // Alias types are enabled by default
testFilesImpl(t, filenames, srcs, manual, opts...)
if !manual {
t.Setenv("GODEBUG", "gotypesalias=0")
diff --git a/src/go/types/decl.go b/src/go/types/decl.go
index 3dab94aa0f..937163fc75 100644
--- a/src/go/types/decl.go
+++ b/src/go/types/decl.go
@@ -607,10 +607,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *TypeName
alias.fromRHS = rhs
Unalias(alias) // resolve alias.actual
} else {
- // With Go1.23, the default behavior is to use Alias nodes,
- // reflected by check.enableAlias. Signal non-default behavior.
- gotypesalias.IncNonDefault()
-
if !versionErr && tparam0 != nil {
check.error(tdecl, UnsupportedFeature, "generic type alias requires GODEBUG=gotypesalias=1 or unset")
versionErr = true
diff --git a/src/internal/godebugs/table.go b/src/internal/godebugs/table.go
index a95c8f2f94..e9e043df4c 100644
--- a/src/internal/godebugs/table.go
+++ b/src/internal/godebugs/table.go
@@ -30,7 +30,7 @@ var All = []Info{
{Name: "gocachehash", Package: "cmd/go"},
{Name: "gocachetest", Package: "cmd/go"},
{Name: "gocacheverify", Package: "cmd/go"},
- {Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0"},
+ {Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0", Opaque: true}, // bug #66216: remove Opaque
{Name: "http2client", Package: "net/http"},
{Name: "http2debug", Package: "net/http", Opaque: true},
{Name: "http2server", Package: "net/http"},
diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go
index fbbeb1a475..deb993241d 100644
--- a/src/runtime/metrics/doc.go
+++ b/src/runtime/metrics/doc.go
@@ -246,10 +246,6 @@ Below is the full list of supported metrics, ordered lexicographically.
The number of non-default behaviors executed by the cmd/go
package due to a non-default GODEBUG=gocacheverify=... setting.
- /godebug/non-default-behavior/gotypesalias:events
- The number of non-default behaviors executed by the go/types
- package due to a non-default GODEBUG=gotypesalias=... setting.
-
/godebug/non-default-behavior/http2client:events
The number of non-default behaviors executed by the net/http
package due to a non-default GODEBUG=http2client=... setting.