mirror of
https://github.com/golang/go.git
synced 2026-06-28 03:40:37 +00:00
cmd/compile: use GOEXPERIMENT from environment for generic methods
The code guarding generic method experiment uses the setting from internal/goexperiment, which is the one used when building the compiler. The common practice of GOEXPERIMENT is that we use the one from the environment at build time of the user code (not the compiler), which is internal/buildcfg.Experiment. Change the code to do so. Also enable the tests. Change-Id: I1ef4e35f82d54204648c1024a5371a95612a25b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/772680 Reviewed-by: Mark Freeman <markfreeman@google.com> 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
5732f4b76a
commit
87fe5fafba
4 changed files with 5 additions and 8 deletions
|
|
@ -7,7 +7,7 @@ package noder
|
|||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"internal/goexperiment"
|
||||
"internal/buildcfg"
|
||||
"internal/pkgbits"
|
||||
"internal/types/errors"
|
||||
"io"
|
||||
|
|
@ -28,7 +28,7 @@ import (
|
|||
// uirVersion is the unified IR version to use for encoding/decoding.
|
||||
// Use V4 for generic methods if the GOEXPERIMENT is enabled.
|
||||
var uirVersion = func() pkgbits.Version {
|
||||
if goexperiment.GenericMethods {
|
||||
if buildcfg.Experiment.GenericMethods {
|
||||
return pkgbits.V4
|
||||
}
|
||||
return pkgbits.V3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// run
|
||||
//go:build goexperiment.genericmethods
|
||||
// run -goexperiment genericmethods
|
||||
|
||||
// Copyright 2026 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// run
|
||||
//go:build goexperiment.genericmethods
|
||||
// run -goexperiment genericmethods
|
||||
|
||||
// Copyright 2026 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// run
|
||||
//go:build goexperiment.genericmethods
|
||||
// run -goexperiment genericmethods
|
||||
|
||||
// Copyright 2026 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue