aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2024-04-17 17:44:55 -0700
committerGopher Robot <gobot@golang.org>2024-04-18 14:10:44 +0000
commit9101bf19165ecde1967a0163d2fafa168e40ac6d (patch)
tree20a5df146ea3ff0c4db8a82818bdcd7f2e256d21 /src/cmd/compile/internal/noder
parent334ce510046ad30b1be466634cf313aad3040892 (diff)
downloadgo-9101bf19165ecde1967a0163d2fafa168e40ac6d.tar.xz
go/types, types2: use types2.Config flag to control Alias node creation
Move Checker.enableAlias to Config.EnableAlias (for types2) and Config._EnableAlias (for go/types), and adjust all uses. Use Config.EnableAlias to control Alias creation for types2 and with that remove dependencies on the gotypesalias GODEBUG setting and problems during bootstrap. The only client is the compiler and there we simply use the desired configuration; it is undesirable for the compiler to be dependent on gotypesalias. Use the gotypesalias GODEBUG setting to control Config._EnableAlias for go/types (similar to before). Adjust some related code. We plan to remove gotypesalias eventually which will remove some of the new discrepancies between types2 and go/types again. Fixes #66874. Change-Id: Id7cc4805e7ea0697e0d023c7f510867e59a24871 Reviewed-on: https://go-review.googlesource.com/c/go/+/579935 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder')
-rw-r--r--src/cmd/compile/internal/noder/irgen.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/noder/irgen.go b/src/cmd/compile/internal/noder/irgen.go
index c159e4823e..34201545b5 100644
--- a/src/cmd/compile/internal/noder/irgen.go
+++ b/src/cmd/compile/internal/noder/irgen.go
@@ -8,7 +8,6 @@ import (
"fmt"
"internal/buildcfg"
"internal/types/errors"
- "os"
"regexp"
"sort"
@@ -50,6 +49,9 @@ func checkFiles(m posMap, noders []*noder) (*types2.Package, *types2.Info) {
IgnoreBranchErrors: true, // parser already checked via syntax.CheckBranches mode
Importer: &importer,
Sizes: types2.SizesFor("gc", buildcfg.GOARCH),
+ // Currently, the compiler panics when using Alias types.
+ // TODO(gri) set to true once this is fixed (issue #66873)
+ EnableAlias: false,
}
if base.Flag.ErrorURL {
conf.ErrorURL = " [go.dev/e/%s]"
@@ -86,10 +88,6 @@ func checkFiles(m posMap, noders []*noder) (*types2.Package, *types2.Info) {
base.ErrorfAt(m.makeXPos(terr.Pos), terr.Code, "%s", msg)
}
- // Currently, the compiler panics when using Alias types.
- // Use the non-default setting for now.
- // TODO(gri) set this to gotypesalias=1 or remove this call.
- os.Setenv("GODEBUG", "gotypesalias=0")
pkg, err := conf.Check(base.Ctxt.Pkgpath, files, info)
base.ExitIfErrors()
if err != nil {