}
func TestCheck(t *testing.T) {
- old := buildcfg.Experiment.RangeFunc
- defer func() {
- buildcfg.Experiment.RangeFunc = old
- }()
- buildcfg.Experiment.RangeFunc = true
-
DefPredeclaredTestFuncs()
testDirFiles(t, "../../../../internal/types/testdata/check", 50, false) // TODO(gri) narrow column tolerance
}
import (
"cmd/compile/internal/syntax"
"go/constant"
- "internal/buildcfg"
. "internal/types/errors"
)
assert(typ.dir != SendOnly)
return typ.elem, nil, "", true
case *Signature:
- if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
+ if allowVersion != nil && !allowVersion(go1_23) {
return bad("requires go1.23 or later")
}
// check iterator arity
}
func TestCheck(t *testing.T) {
- old := buildcfg.Experiment.RangeFunc
- defer func() {
- buildcfg.Experiment.RangeFunc = old
- }()
- buildcfg.Experiment.RangeFunc = true
-
DefPredeclaredTestFuncs()
testDirFiles(t, "../../internal/types/testdata/check", false)
}
import (
"go/ast"
"go/constant"
- "internal/buildcfg"
. "internal/types/errors"
)
assert(typ.dir != SendOnly)
return typ.elem, nil, "", true
case *Signature:
- if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
+ if allowVersion != nil && !allowVersion(go1_23) {
return bad("requires go1.23 or later")
}
// check iterator arity
+++ /dev/null
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build !goexperiment.rangefunc
-
-package goexperiment
-
-const RangeFunc = false
-const RangeFuncInt = 0
+++ /dev/null
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build goexperiment.rangefunc
-
-package goexperiment
-
-const RangeFunc = true
-const RangeFuncInt = 1
// inlining phase within the Go compiler.
NewInliner bool
- // RangeFunc enables range over func.
- RangeFunc 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.
buildCmd.Args = append(buildCmd.Args, "-race")
}
buildCmd.Args = append(buildCmd.Args, testPath)
- buildCmd.Env = append(os.Environ(), "GOEXPERIMENT=rangefunc")
buildOutput, err := buildCmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to build %s: %v: output:\n%s", testPath, err, buildOutput)
t.Logf("running %v", cmd)
cmd.Dir = "testdata/" + binary
cmd = testenv.CleanCmdEnv(cmd)
-
- // Add the rangefunc GOEXPERIMENT unconditionally since some tests depend on it.
- // TODO(61405): Remove this once it's enabled by default.
- edited := false
- for i := range cmd.Env {
- e := cmd.Env[i]
- if _, vars, ok := strings.Cut(e, "GOEXPERIMENT="); ok {
- cmd.Env[i] = "GOEXPERIMENT=" + vars + ",rangefunc"
- edited = true
- }
- }
- if !edited {
- cmd.Env = append(cmd.Env, "GOEXPERIMENT=rangefunc")
- }
-
out, err := cmd.CombinedOutput()
if err != nil {
target.err = fmt.Errorf("building %s %v: %v\n%s", binary, flags, err, out)
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc
-
package race_test
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc
-
package main
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc && !windows
+//go:build !windows
package main
-// errorcheck -goexperiment rangefunc
+// errorcheck
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
-// run -goexperiment rangefunc
+// run
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
-// runoutput -goexperiment rangefunc
+// runoutput
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style