mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00: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) {
|
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
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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.
|
// 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
|
||||||
}
|
}
|
||||||
|
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.
|
// 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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user