aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/compile/internal/noder/unified.go8
-rw-r--r--src/cmd/compile/internal/noder/writer.go7
-rw-r--r--src/cmd/compile/internal/types2/decl.go5
-rw-r--r--src/cmd/compile/internal/types2/instantiate.go5
-rw-r--r--src/cmd/compile/internal/types2/object_test.go7
-rw-r--r--src/cmd/compile/internal/types2/stdlib_test.go2
-rw-r--r--src/go/types/decl.go5
-rw-r--r--src/go/types/instantiate.go5
-rw-r--r--src/go/types/object_test.go5
-rw-r--r--src/go/types/stdlib_test.go2
-rw-r--r--src/internal/buildcfg/exp.go7
-rw-r--r--src/internal/goexperiment/exp_aliastypeparams_off.go8
-rw-r--r--src/internal/goexperiment/exp_aliastypeparams_on.go8
-rw-r--r--src/internal/goexperiment/flags.go5
-rw-r--r--src/internal/types/testdata/fixedbugs/issue67683.go2
-rw-r--r--src/internal/types/testdata/fixedbugs/issue69576.go2
-rw-r--r--src/internal/types/testdata/spec/typeAliases1.23b.go2
-rw-r--r--test/fixedbugs/issue68054.go2
-rw-r--r--test/fixedbugs/issue68526.dir/a/a.go2
-rw-r--r--test/fixedbugs/issue68526.dir/main.go2
-rw-r--r--test/fixedbugs/issue68526.go2
-rw-r--r--test/fixedbugs/issue68580.go2
22 files changed, 19 insertions, 76 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
diff --git a/src/go/types/decl.go b/src/go/types/decl.go
index f40a8e54b9..42423d291c 100644
--- a/src/go/types/decl.go
+++ b/src/go/types/decl.go
@@ -9,7 +9,6 @@ import (
"go/ast"
"go/constant"
"go/token"
- "internal/buildcfg"
. "internal/types/errors"
"slices"
)
@@ -600,10 +599,6 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *TypeName
// 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.TypeParams)
diff --git a/src/go/types/instantiate.go b/src/go/types/instantiate.go
index db270eb556..eef473447d 100644
--- a/src/go/types/instantiate.go
+++ b/src/go/types/instantiate.go
@@ -14,7 +14,6 @@ import (
"errors"
"fmt"
"go/token"
- "internal/buildcfg"
. "internal/types/errors"
)
@@ -133,10 +132,6 @@ func (check *Checker) instance(pos token.Pos, orig genericType, targs []Type, ex
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/go/types/object_test.go b/src/go/types/object_test.go
index 0b4fce7bb1..fc165fb7a0 100644
--- a/src/go/types/object_test.go
+++ b/src/go/types/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},
@@ -115,8 +114,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()
t.Setenv("GODEBUG", "gotypesalias=1")
}
diff --git a/src/go/types/stdlib_test.go b/src/go/types/stdlib_test.go
index 8e95d23ec3..79ccbc6fcf 100644
--- a/src/go/types/stdlib_test.go
+++ b/src/go/types/stdlib_test.go
@@ -334,6 +334,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", // go/types 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
diff --git a/src/internal/buildcfg/exp.go b/src/internal/buildcfg/exp.go
index df84e9fdf4..310226bc01 100644
--- a/src/internal/buildcfg/exp.go
+++ b/src/internal/buildcfg/exp.go
@@ -79,10 +79,9 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) {
dwarf5Supported := (goos != "darwin" && goos != "ios" && goos != "aix")
baseline := goexperiment.Flags{
- RegabiWrappers: regabiSupported,
- RegabiArgs: regabiSupported,
- AliasTypeParams: true,
- Dwarf5: dwarf5Supported,
+ RegabiWrappers: regabiSupported,
+ RegabiArgs: regabiSupported,
+ Dwarf5: dwarf5Supported,
}
// Start with the statically enabled set of experiments.
diff --git a/src/internal/goexperiment/exp_aliastypeparams_off.go b/src/internal/goexperiment/exp_aliastypeparams_off.go
deleted file mode 100644
index 620d34ec79..0000000000
--- a/src/internal/goexperiment/exp_aliastypeparams_off.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build !goexperiment.aliastypeparams
-
-package goexperiment
-
-const AliasTypeParams = false
-const AliasTypeParamsInt = 0
diff --git a/src/internal/goexperiment/exp_aliastypeparams_on.go b/src/internal/goexperiment/exp_aliastypeparams_on.go
deleted file mode 100644
index 8f6872cdcd..0000000000
--- a/src/internal/goexperiment/exp_aliastypeparams_on.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build goexperiment.aliastypeparams
-
-package goexperiment
-
-const AliasTypeParams = true
-const AliasTypeParamsInt = 1
diff --git a/src/internal/goexperiment/flags.go b/src/internal/goexperiment/flags.go
index dd7a4f446c..3144d3adfc 100644
--- a/src/internal/goexperiment/flags.go
+++ b/src/internal/goexperiment/flags.go
@@ -100,11 +100,6 @@ type Flags struct {
// inlining phase within the Go compiler.
NewInliner bool
- // AliasTypeParams enables type parameters for alias types.
- // Requires that gotypesalias=1 is set with GODEBUG.
- // This flag will be removed with Go 1.25.
- AliasTypeParams bool
-
// Synctest enables the testing/synctest package.
Synctest bool
diff --git a/src/internal/types/testdata/fixedbugs/issue67683.go b/src/internal/types/testdata/fixedbugs/issue67683.go
index f7c9bcdd01..c9ad5f6788 100644
--- a/src/internal/types/testdata/fixedbugs/issue67683.go
+++ b/src/internal/types/testdata/fixedbugs/issue67683.go
@@ -1,4 +1,4 @@
-// -goexperiment=aliastypeparams -gotypesalias=1
+// -gotypesalias=1
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/internal/types/testdata/fixedbugs/issue69576.go b/src/internal/types/testdata/fixedbugs/issue69576.go
index 97e03dfab4..fc436bbfd3 100644
--- a/src/internal/types/testdata/fixedbugs/issue69576.go
+++ b/src/internal/types/testdata/fixedbugs/issue69576.go
@@ -1,4 +1,4 @@
-// -goexperiment=aliastypeparams -gotypesalias=1
+// -gotypesalias=1
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/internal/types/testdata/spec/typeAliases1.23b.go b/src/internal/types/testdata/spec/typeAliases1.23b.go
index c92c3d3a7e..8a09899066 100644
--- a/src/internal/types/testdata/spec/typeAliases1.23b.go
+++ b/src/internal/types/testdata/spec/typeAliases1.23b.go
@@ -1,4 +1,4 @@
-// -lang=go1.23 -gotypesalias=1 -goexperiment=aliastypeparams
+// -lang=go1.23 -gotypesalias=1
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue68054.go b/test/fixedbugs/issue68054.go
index 5409fc9081..e9f95efa14 100644
--- a/test/fixedbugs/issue68054.go
+++ b/test/fixedbugs/issue68054.go
@@ -1,4 +1,4 @@
-// compile -goexperiment aliastypeparams
+// compile
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue68526.dir/a/a.go b/test/fixedbugs/issue68526.dir/a/a.go
index 83462c7fb9..6249eb59df 100644
--- a/test/fixedbugs/issue68526.dir/a/a.go
+++ b/test/fixedbugs/issue68526.dir/a/a.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.aliastypeparams
-
package a
type A[T any] = struct{ F T }
diff --git a/test/fixedbugs/issue68526.dir/main.go b/test/fixedbugs/issue68526.dir/main.go
index 966efd7190..8b72ea37b6 100644
--- a/test/fixedbugs/issue68526.dir/main.go
+++ b/test/fixedbugs/issue68526.dir/main.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.aliastypeparams
-
package main
import (
diff --git a/test/fixedbugs/issue68526.go b/test/fixedbugs/issue68526.go
index 3067aa7622..aca6354b7c 100644
--- a/test/fixedbugs/issue68526.go
+++ b/test/fixedbugs/issue68526.go
@@ -1,4 +1,4 @@
-// runindir -goexperiment aliastypeparams -gomodversion "1.23"
+// runindir -gomodversion "1.23"
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue68580.go b/test/fixedbugs/issue68580.go
index b60a7447aa..5c25d15b43 100644
--- a/test/fixedbugs/issue68580.go
+++ b/test/fixedbugs/issue68580.go
@@ -1,4 +1,4 @@
-// compile -goexperiment aliastypeparams
+// compile
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style