mirror of
https://github.com/golang/go.git
synced 2026-06-27 03:11:23 +00:00
internal/goexperiment: put generic methods behind GOEXPERIMENT
This feature will not launch behind a goexperiment. This is only used to let in interested users and gate tests during development without disrupting x/tools. Change-Id: I97a944bdc3db610ee8a4409f8cdd9a6ddddd59d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/772441 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
17bd5ab8c6
commit
aa62c18749
4 changed files with 27 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ package noder
|
|||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"internal/goexperiment"
|
||||
"internal/pkgbits"
|
||||
"internal/types/errors"
|
||||
"io"
|
||||
|
|
@ -25,8 +26,13 @@ import (
|
|||
)
|
||||
|
||||
// uirVersion is the unified IR version to use for encoding/decoding.
|
||||
// Use V4 for generic methods; keep at V3 while we refine and test.
|
||||
const uirVersion = pkgbits.V3
|
||||
// Use V4 for generic methods if the GOEXPERIMENT is enabled.
|
||||
var uirVersion = func() pkgbits.Version {
|
||||
if goexperiment.GenericMethods {
|
||||
return pkgbits.V4
|
||||
}
|
||||
return pkgbits.V3
|
||||
}()
|
||||
|
||||
// localPkgReader holds the package reader used for reading the local
|
||||
// package. It exists so the unified IR linker can refer back to it
|
||||
|
|
|
|||
8
src/internal/goexperiment/exp_genericmethods_off.go
Normal file
8
src/internal/goexperiment/exp_genericmethods_off.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build !goexperiment.genericmethods
|
||||
|
||||
package goexperiment
|
||||
|
||||
const GenericMethods = false
|
||||
const GenericMethodsInt = 0
|
||||
8
src/internal/goexperiment/exp_genericmethods_on.go
Normal file
8
src/internal/goexperiment/exp_genericmethods_on.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build goexperiment.genericmethods
|
||||
|
||||
package goexperiment
|
||||
|
||||
const GenericMethods = true
|
||||
const GenericMethodsInt = 1
|
||||
|
|
@ -133,4 +133,7 @@ type Flags struct {
|
|||
// from interleaved key/elem slots (KVKVKVKV) to split key and elem
|
||||
// arrays (KKKKVVVV).
|
||||
MapSplitGroup bool
|
||||
|
||||
// GenericMethods enables use of generic methods.
|
||||
GenericMethods bool
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue