aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/test
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-11-11 14:48:22 -0500
committerGopher Robot <gobot@golang.org>2025-11-11 19:59:40 -0800
commit4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2 (patch)
tree0cbf1ec55d3a61af8bf45ac4a00af7e7bcc426db /src/cmd/compile/internal/test
parent2263d4aabdde8a4a466009ecc356501f87c7efb7 (diff)
downloadgo-4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2.tar.xz
std,cmd: go fix -any std cmd
This change mechanically replaces all occurrences of interface{} by 'any' (where deemed safe by the 'any' modernizer) throughout std and cmd, minus their vendor trees. Since this fix is relatively numerous, it gets its own CL. Also, 'go generate go/types'. Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/719702 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/cmd/compile/internal/test')
-rw-r--r--src/cmd/compile/internal/test/fixedbugs_test.go2
-rw-r--r--src/cmd/compile/internal/test/iface_test.go14
-rw-r--r--src/cmd/compile/internal/test/shift_test.go2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/test/fixedbugs_test.go b/src/cmd/compile/internal/test/fixedbugs_test.go
index 8ff7a60aae..b6d3e248ad 100644
--- a/src/cmd/compile/internal/test/fixedbugs_test.go
+++ b/src/cmd/compile/internal/test/fixedbugs_test.go
@@ -24,7 +24,7 @@ func makeT() T {
var g T
-var sink interface{}
+var sink any
func TestIssue15854(t *testing.T) {
for i := 0; i < 10000; i++ {
diff --git a/src/cmd/compile/internal/test/iface_test.go b/src/cmd/compile/internal/test/iface_test.go
index db41eb8e55..cb7dc70c2f 100644
--- a/src/cmd/compile/internal/test/iface_test.go
+++ b/src/cmd/compile/internal/test/iface_test.go
@@ -13,7 +13,7 @@ var x int
func TestEfaceConv1(t *testing.T) {
a := 5
- i := interface{}(a)
+ i := any(a)
a += 2
if got := i.(int); got != 5 {
t.Errorf("wanted 5, got %d\n", got)
@@ -23,7 +23,7 @@ func TestEfaceConv1(t *testing.T) {
func TestEfaceConv2(t *testing.T) {
a := 5
sink = &a
- i := interface{}(a)
+ i := any(a)
a += 2
if got := i.(int); got != 5 {
t.Errorf("wanted 5, got %d\n", got)
@@ -38,7 +38,7 @@ func TestEfaceConv3(t *testing.T) {
}
//go:noinline
-func e2int3(i interface{}) int {
+func e2int3(i any) int {
x = 7
return i.(int)
}
@@ -51,7 +51,7 @@ func TestEfaceConv4(t *testing.T) {
}
//go:noinline
-func e2int4(i interface{}, p *int) int {
+func e2int4(i any, p *int) int {
*p = 7
return i.(int)
}
@@ -69,7 +69,7 @@ func (i Int) foo() {
func TestIfaceConv1(t *testing.T) {
a := Int(5)
- i := interface{}(a)
+ i := any(a)
a += 2
if got := i.(Int); got != 5 {
t.Errorf("wanted 5, got %d\n", int(got))
@@ -79,7 +79,7 @@ func TestIfaceConv1(t *testing.T) {
func TestIfaceConv2(t *testing.T) {
a := Int(5)
sink = &a
- i := interface{}(a)
+ i := any(a)
a += 2
if got := i.(Int); got != 5 {
t.Errorf("wanted 5, got %d\n", int(got))
@@ -121,7 +121,7 @@ func BenchmarkEfaceInteger(b *testing.B) {
}
//go:noinline
-func i2int(i interface{}) int {
+func i2int(i any) int {
return i.(int)
}
diff --git a/src/cmd/compile/internal/test/shift_test.go b/src/cmd/compile/internal/test/shift_test.go
index 492379e188..d540f25c73 100644
--- a/src/cmd/compile/internal/test/shift_test.go
+++ b/src/cmd/compile/internal/test/shift_test.go
@@ -916,7 +916,7 @@ func TestShiftGeneric(t *testing.T) {
signed bool
shiftWidth int
left bool
- f interface{}
+ f any
}{
{64, true, 64, true, func(n int64, s uint64) int64 { return n << s }},
{64, true, 64, false, func(n int64, s uint64) int64 { return n >> s }},