all: rename GOEXPERIMENT=range to rangefunc

Range over integer is enabled now without the GOEXPERIMENT. The
GOEXPERIMENT is only for range over func. Rename it to rangefunc.

For #61405.

Change-Id: I9405fb8e2e30827875716786823856090a1a0cad
Reviewed-on: https://go-review.googlesource.com/c/go/+/539277
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Cherry Mui 2023-11-07 12:01:09 -05:00
parent 3f700ce4d2
commit 45320c23f2
13 changed files with 30 additions and 30 deletions

View file

@ -368,11 +368,11 @@ func TestIssue47243_TypedRHS(t *testing.T) {
} }
func TestCheck(t *testing.T) { func TestCheck(t *testing.T) {
old := buildcfg.Experiment.Range old := buildcfg.Experiment.RangeFunc
defer func() { defer func() {
buildcfg.Experiment.Range = old buildcfg.Experiment.RangeFunc = old
}() }()
buildcfg.Experiment.Range = true buildcfg.Experiment.RangeFunc = true
DefPredeclaredTestFuncs() DefPredeclaredTestFuncs()
testDirFiles(t, "../../../../internal/types/testdata/check", 50, false) // TODO(gri) narrow column tolerance testDirFiles(t, "../../../../internal/types/testdata/check", 50, false) // TODO(gri) narrow column tolerance

View file

@ -1009,7 +1009,7 @@ func rangeKeyVal(typ Type) (key, val Type, cause string, isFunc, ok bool) {
} }
return typ.elem, nil, "", false, true return typ.elem, nil, "", false, true
case *Signature: case *Signature:
if !buildcfg.Experiment.Range { if !buildcfg.Experiment.RangeFunc {
break break
} }
assert(typ.Recv() == nil) assert(typ.Recv() == nil)

View file

@ -396,11 +396,11 @@ func TestIssue47243_TypedRHS(t *testing.T) {
} }
func TestCheck(t *testing.T) { func TestCheck(t *testing.T) {
old := buildcfg.Experiment.Range old := buildcfg.Experiment.RangeFunc
defer func() { defer func() {
buildcfg.Experiment.Range = old buildcfg.Experiment.RangeFunc = old
}() }()
buildcfg.Experiment.Range = true buildcfg.Experiment.RangeFunc = true
DefPredeclaredTestFuncs() DefPredeclaredTestFuncs()
testDirFiles(t, "../../internal/types/testdata/check", false) testDirFiles(t, "../../internal/types/testdata/check", false)

View file

@ -994,7 +994,7 @@ func rangeKeyVal(typ Type) (key, val Type, cause string, isFunc, ok bool) {
} }
return typ.elem, nil, "", false, true return typ.elem, nil, "", false, true
case *Signature: case *Signature:
if !buildcfg.Experiment.Range { if !buildcfg.Experiment.RangeFunc {
break break
} }
assert(typ.Recv() == nil) assert(typ.Recv() == nil)

View file

@ -1,8 +0,0 @@
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.range
package goexperiment
const Range = false
const RangeInt = 0

View file

@ -1,8 +0,0 @@
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.range
package goexperiment
const Range = true
const RangeInt = 1

View file

@ -0,0 +1,8 @@
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.rangefunc
package goexperiment
const RangeFunc = false
const RangeFuncInt = 0

View file

@ -0,0 +1,8 @@
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.rangefunc
package goexperiment
const RangeFunc = true
const RangeFuncInt = 1

View file

@ -114,6 +114,6 @@ type Flags struct {
// inlining phase within the Go compiler. // inlining phase within the Go compiler.
NewInliner bool NewInliner bool
// Range enables range over int and func. // RangeFunc enables range over func.
Range bool RangeFunc bool
} }

View file

@ -1,4 +1,4 @@
// -goexperiment=range // -goexperiment=rangefunc
// Copyright 2023 The Go Authors. All rights reserved. // Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

View file

@ -1,4 +1,4 @@
// errorcheck -goexperiment range // errorcheck -goexperiment rangefunc
// Copyright 2023 The Go Authors. All rights reserved. // Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

View file

@ -1,4 +1,4 @@
// run -goexperiment range // run -goexperiment rangefunc
// Copyright 2023 The Go Authors. All rights reserved. // Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

View file

@ -1,4 +1,4 @@
// runoutput -goexperiment range // runoutput -goexperiment rangefunc
// Copyright 2023 The Go Authors. All rights reserved. // Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style