mirror of
https://github.com/golang/go
synced 2024-11-25 07:17:56 -07:00
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:
parent
3f700ce4d2
commit
45320c23f2
@ -368,11 +368,11 @@ func TestIssue47243_TypedRHS(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
old := buildcfg.Experiment.Range
|
||||
old := buildcfg.Experiment.RangeFunc
|
||||
defer func() {
|
||||
buildcfg.Experiment.Range = old
|
||||
buildcfg.Experiment.RangeFunc = old
|
||||
}()
|
||||
buildcfg.Experiment.Range = true
|
||||
buildcfg.Experiment.RangeFunc = true
|
||||
|
||||
DefPredeclaredTestFuncs()
|
||||
testDirFiles(t, "../../../../internal/types/testdata/check", 50, false) // TODO(gri) narrow column tolerance
|
||||
|
@ -1009,7 +1009,7 @@ func rangeKeyVal(typ Type) (key, val Type, cause string, isFunc, ok bool) {
|
||||
}
|
||||
return typ.elem, nil, "", false, true
|
||||
case *Signature:
|
||||
if !buildcfg.Experiment.Range {
|
||||
if !buildcfg.Experiment.RangeFunc {
|
||||
break
|
||||
}
|
||||
assert(typ.Recv() == nil)
|
||||
|
@ -396,11 +396,11 @@ func TestIssue47243_TypedRHS(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
old := buildcfg.Experiment.Range
|
||||
old := buildcfg.Experiment.RangeFunc
|
||||
defer func() {
|
||||
buildcfg.Experiment.Range = old
|
||||
buildcfg.Experiment.RangeFunc = old
|
||||
}()
|
||||
buildcfg.Experiment.Range = true
|
||||
buildcfg.Experiment.RangeFunc = true
|
||||
|
||||
DefPredeclaredTestFuncs()
|
||||
testDirFiles(t, "../../internal/types/testdata/check", false)
|
||||
|
@ -994,7 +994,7 @@ func rangeKeyVal(typ Type) (key, val Type, cause string, isFunc, ok bool) {
|
||||
}
|
||||
return typ.elem, nil, "", false, true
|
||||
case *Signature:
|
||||
if !buildcfg.Experiment.Range {
|
||||
if !buildcfg.Experiment.RangeFunc {
|
||||
break
|
||||
}
|
||||
assert(typ.Recv() == nil)
|
||||
|
@ -1,8 +0,0 @@
|
||||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build !goexperiment.range
|
||||
|
||||
package goexperiment
|
||||
|
||||
const Range = false
|
||||
const RangeInt = 0
|
@ -1,8 +0,0 @@
|
||||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build goexperiment.range
|
||||
|
||||
package goexperiment
|
||||
|
||||
const Range = true
|
||||
const RangeInt = 1
|
8
src/internal/goexperiment/exp_rangefunc_off.go
Normal file
8
src/internal/goexperiment/exp_rangefunc_off.go
Normal 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
|
8
src/internal/goexperiment/exp_rangefunc_on.go
Normal file
8
src/internal/goexperiment/exp_rangefunc_on.go
Normal 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
|
@ -114,6 +114,6 @@ type Flags struct {
|
||||
// inlining phase within the Go compiler.
|
||||
NewInliner bool
|
||||
|
||||
// Range enables range over int and func.
|
||||
Range bool
|
||||
// RangeFunc enables range over func.
|
||||
RangeFunc bool
|
||||
}
|
||||
|
2
src/internal/types/testdata/spec/range.go
vendored
2
src/internal/types/testdata/spec/range.go
vendored
@ -1,4 +1,4 @@
|
||||
// -goexperiment=range
|
||||
// -goexperiment=rangefunc
|
||||
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
@ -1,4 +1,4 @@
|
||||
// errorcheck -goexperiment range
|
||||
// errorcheck -goexperiment rangefunc
|
||||
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
@ -1,4 +1,4 @@
|
||||
// run -goexperiment range
|
||||
// run -goexperiment rangefunc
|
||||
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
@ -1,4 +1,4 @@
|
||||
// runoutput -goexperiment range
|
||||
// runoutput -goexperiment rangefunc
|
||||
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
Loading…
Reference in New Issue
Block a user