diff options
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/compile/internal/noder/unified.go | 8 | ||||
| -rw-r--r-- | src/cmd/compile/internal/noder/writer.go | 7 | ||||
| -rw-r--r-- | src/cmd/compile/internal/types2/decl.go | 5 | ||||
| -rw-r--r-- | src/cmd/compile/internal/types2/instantiate.go | 5 | ||||
| -rw-r--r-- | src/cmd/compile/internal/types2/object_test.go | 7 | ||||
| -rw-r--r-- | src/cmd/compile/internal/types2/stdlib_test.go | 2 |
6 files changed, 7 insertions, 27 deletions
diff --git a/src/cmd/compile/internal/noder/unified.go b/src/cmd/compile/internal/noder/unified.go index 85982d7c18..05f4483d0d 100644 --- a/src/cmd/compile/internal/noder/unified.go +++ b/src/cmd/compile/internal/noder/unified.go @@ -7,7 +7,6 @@ package noder import ( "cmp" "fmt" - "internal/buildcfg" "internal/pkgbits" "internal/types/errors" "io" @@ -464,11 +463,8 @@ func readPackage(pr *pkgReader, importpkg *types.Pkg, localStub bool) { // writeUnifiedExport writes to `out` the finalized, self-contained // Unified IR export data file for the current compilation unit. func writeUnifiedExport(out io.Writer) { - // Use V2 as the encoded version aliastypeparams GOEXPERIMENT is enabled. - version := pkgbits.V1 - if buildcfg.Experiment.AliasTypeParams { - version = pkgbits.V2 - } + // Use V2 as the encoded version for aliastypeparams. + version := pkgbits.V2 l := linker{ pw: pkgbits.NewPkgEncoder(version, base.Debug.SyncFrames), diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go index baff0ceea0..54e5f1ea5f 100644 --- a/src/cmd/compile/internal/noder/writer.go +++ b/src/cmd/compile/internal/noder/writer.go @@ -96,11 +96,8 @@ type pkgWriter struct { // newPkgWriter returns an initialized pkgWriter for the specified // package. func newPkgWriter(m posMap, pkg *types2.Package, info *types2.Info, otherInfo map[*syntax.FuncLit]bool) *pkgWriter { - // Use V2 as the encoded version aliastypeparams GOEXPERIMENT is enabled. - version := pkgbits.V1 - if buildcfg.Experiment.AliasTypeParams { - version = pkgbits.V2 - } + // Use V2 as the encoded version for aliastypeparams. + version := pkgbits.V2 return &pkgWriter{ PkgEncoder: pkgbits.NewPkgEncoder(version, base.Debug.SyncFrames), diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go index 64047aa84f..34105816a6 100644 --- a/src/cmd/compile/internal/types2/decl.go +++ b/src/cmd/compile/internal/types2/decl.go @@ -8,7 +8,6 @@ import ( "cmd/compile/internal/syntax" "fmt" "go/constant" - "internal/buildcfg" . "internal/types/errors" "slices" ) @@ -525,10 +524,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *TypeN // handle type parameters even if not allowed (Alias type is supported) if tparam0 != nil { - if !versionErr && !buildcfg.Experiment.AliasTypeParams { - check.error(tdecl, UnsupportedFeature, "generic type alias requires GOEXPERIMENT=aliastypeparams") - versionErr = true - } check.openScope(tdecl, "type parameters") defer check.closeScope() check.collectTypeParams(&alias.tparams, tdecl.TParamList) diff --git a/src/cmd/compile/internal/types2/instantiate.go b/src/cmd/compile/internal/types2/instantiate.go index f7346cab46..1c8c12d07c 100644 --- a/src/cmd/compile/internal/types2/instantiate.go +++ b/src/cmd/compile/internal/types2/instantiate.go @@ -11,7 +11,6 @@ import ( "cmd/compile/internal/syntax" "errors" "fmt" - "internal/buildcfg" . "internal/types/errors" ) @@ -130,10 +129,6 @@ func (check *Checker) instance(pos syntax.Pos, orig genericType, targs []Type, e res = check.newNamedInstance(pos, orig, targs, expanding) // substituted lazily case *Alias: - if !buildcfg.Experiment.AliasTypeParams { - assert(expanding == nil) // Alias instances cannot be reached from Named types - } - // verify type parameter count (see go.dev/issue/71198 for a test case) tparams := orig.TypeParams() if !check.validateTArgLen(pos, orig.obj.Name(), tparams.Len(), len(targs)) { diff --git a/src/cmd/compile/internal/types2/object_test.go b/src/cmd/compile/internal/types2/object_test.go index f19264e4db..4f1a653ff3 100644 --- a/src/cmd/compile/internal/types2/object_test.go +++ b/src/cmd/compile/internal/types2/object_test.go @@ -99,8 +99,7 @@ var testObjects = []struct { {"type t = struct{f int}", "t", "type p.t = struct{f int}", false}, {"type t = func(int)", "t", "type p.t = func(int)", false}, {"type A = B; type B = int", "A", "type p.A = p.B", true}, - {"type A[P ~int] = struct{}", "A", "type p.A[P ~int] = struct{}", true}, // requires GOEXPERIMENT=aliastypeparams - + {"type A[P ~int] = struct{}", "A", "type p.A[P ~int] = struct{}", true}, {"var v int", "v", "var p.v int", false}, {"func f(int) string", "f", "func p.f(int) string", false}, @@ -114,10 +113,6 @@ func TestObjectString(t *testing.T) { for i, test := range testObjects { t.Run(fmt.Sprint(i), func(t *testing.T) { - if test.alias { - revert := setGOEXPERIMENT("aliastypeparams") - defer revert() - } src := "package p; " + test.src conf := Config{Error: func(error) {}, Importer: defaultImporter(), EnableAlias: test.alias} pkg, err := typecheck(src, &conf, nil) diff --git a/src/cmd/compile/internal/types2/stdlib_test.go b/src/cmd/compile/internal/types2/stdlib_test.go index 35e15d814d..365bc97462 100644 --- a/src/cmd/compile/internal/types2/stdlib_test.go +++ b/src/cmd/compile/internal/types2/stdlib_test.go @@ -332,6 +332,8 @@ func TestStdFixed(t *testing.T) { "issue49814.go", // go/types does not have constraints on array size "issue56103.go", // anonymous interface cycles; will be a type checker error in 1.22 "issue52697.go", // types2 does not have constraints on stack size + "issue68054.go", // this test requires GODEBUG=gotypesalias=1 + "issue68580.go", // this test requires GODEBUG=gotypesalias=1 "issue73309.go", // this test requires GODEBUG=gotypesalias=1 "issue73309b.go", // this test requires GODEBUG=gotypesalias=1 |
