mirror of https://github.com/golang/go.git
Revert "internal/typeparams: hide go1.18 API usage behind a build constraint"
This reverts commit 0df0ca0f43.
Reason for revert: we've tagged x/tools@v0.1.7, and want to use the new APIs again.
Change-Id: I5c6f2075833948cc21896d1746e0c51cc0712bb1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/352855
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
0df0ca0f43
commit
df9a164fb3
|
|
@ -22,7 +22,6 @@ import (
|
|||
"time"
|
||||
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
"golang.org/x/tools/internal/typeparams"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
|
@ -107,12 +106,6 @@ func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
|
|||
for _, ext := range pkgExts {
|
||||
if strings.HasSuffix(f.Name(), ext) {
|
||||
name := f.Name()[0 : len(f.Name())-len(ext)] // remove extension
|
||||
if testenv.UsesGenerics(name) && !typeparams.Enabled {
|
||||
// golang/go#48632: Skip generic packages when type parameters are
|
||||
// not enabled, as a temporary measure to allow avoiding the new
|
||||
// go/types API on Go 1.18.
|
||||
continue
|
||||
}
|
||||
if testPath(t, filepath.Join(dir, name), dir) != nil {
|
||||
nimports++
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build typeparams && go1.18
|
||||
// +build typeparams,go1.18
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package gcimporter_test
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import (
|
|||
"golang.org/x/tools/go/internal/gcimporter"
|
||||
"golang.org/x/tools/go/loader"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
"golang.org/x/tools/internal/typeparams"
|
||||
)
|
||||
|
||||
func readExportFile(filename string) ([]byte, error) {
|
||||
|
|
@ -97,12 +96,9 @@ func TestIExportData_stdlib(t *testing.T) {
|
|||
// TODO(#48595): fix this test with GOEXPERIMENT=unified.
|
||||
isUnified := isUnifiedBuilder()
|
||||
for _, path := range buildutil.AllPackages(conf.Build) {
|
||||
if testenv.UsesGenerics(path) && (isUnified || !typeparams.Enabled) {
|
||||
// golang/go#48632: Skip generic packages if we can't handle type
|
||||
// parameters.
|
||||
continue
|
||||
if !(isUnified && testenv.UsesGenerics(path)) {
|
||||
conf.Import(path)
|
||||
}
|
||||
conf.Import(path)
|
||||
}
|
||||
|
||||
// Create a package containing type and value errors to ensure
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !typeparams || !go1.18
|
||||
// +build !typeparams !go1.18
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package gcimporter
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build typeparams && go1.18
|
||||
// +build typeparams,go1.18
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package gcimporter
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !typeparams || !go1.18
|
||||
// +build !typeparams !go1.18
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package typeparams
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build typeparams && go1.18
|
||||
// +build typeparams,go1.18
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package typeparams
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !typeparams || !go1.18
|
||||
// +build !typeparams !go1.18
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package typeparams
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build typeparams && go1.18
|
||||
// +build typeparams,go1.18
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package typeparams
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build typeparams && go1.18
|
||||
// +build typeparams,go1.18
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package typeparams_test
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue