diff options
| author | Robert Griesemer <gri@google.com> | 2026-01-14 16:10:00 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-01-22 21:37:55 -0800 |
| commit | 6edb9f9c51f4f9042563f6fcf68701d1fed33c8f (patch) | |
| tree | 8bf472b21d658f6a189a86abb8dbb9790179e648 /src/internal | |
| parent | 819c53c25f2992113c202644045b93bd3a578f54 (diff) | |
| download | go-6edb9f9c51f4f9042563f6fcf68701d1fed33c8f.tar.xz | |
go/types, types2: remove support for gotypesalias GODEBUG flag
For #76472.
Change-Id: Ia51b41639637b1de916625e73c26f625382be305
Reviewed-on: https://go-review.googlesource.com/c/go/+/736441
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/internal')
20 files changed, 5 insertions, 292 deletions
diff --git a/src/internal/godebugs/table.go b/src/internal/godebugs/table.go index 87b499385a..a7c984b5e2 100644 --- a/src/internal/godebugs/table.go +++ b/src/internal/godebugs/table.go @@ -39,7 +39,6 @@ var All = []Info{ {Name: "gocachetest", Package: "cmd/go"}, {Name: "gocacheverify", Package: "cmd/go"}, {Name: "gotestjsonbuildtext", Package: "cmd/go", Changed: 24, Old: "1"}, - {Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0"}, {Name: "http2client", Package: "net/http"}, {Name: "http2debug", Package: "net/http", Opaque: true}, {Name: "http2server", Package: "net/http"}, @@ -90,6 +89,7 @@ type RemovedInfo struct { // Removed contains all GODEBUGs that we have removed. var Removed = []RemovedInfo{ {Name: "x509sha1", Removed: 24}, + {Name: "gotypesalias", Removed: 27}, } // Lookup returns the Info with the given name. diff --git a/src/internal/types/testdata/check/cycles5.go b/src/internal/types/testdata/check/cycles5.go index 9605f8ded4..40a6d9b483 100644 --- a/src/internal/types/testdata/check/cycles5.go +++ b/src/internal/types/testdata/check/cycles5.go @@ -1,5 +1,3 @@ -// -gotypesalias=0 - // Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -137,7 +135,7 @@ type ( type ( a struct{ *b } b = c - c struct{ *b /* ERROR "invalid use of type alias" */ } + c struct{ *b } ) // issue #24939 @@ -147,7 +145,7 @@ type ( } M interface { - F() P // ERROR "invalid use of type alias" + F() P } P = interface { diff --git a/src/internal/types/testdata/check/cycles5a.go b/src/internal/types/testdata/check/cycles5a.go deleted file mode 100644 index a8cad50243..0000000000 --- a/src/internal/types/testdata/check/cycles5a.go +++ /dev/null @@ -1,202 +0,0 @@ -// -gotypesalias=1 - -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package p - -import "unsafe" - -// test case from issue #18395 - -type ( - A interface { B } - B interface { C } - C interface { D; F() A } - D interface { G() B } -) - -var _ = A(nil).G // G must be found - - -// test case from issue #21804 - -type sourceBridge interface { - listVersions() ([]Version, error) -} - -type Constraint interface { - copyTo(*ConstraintMsg) -} - -type ConstraintMsg struct{} - -func (m *ConstraintMsg) asUnpairedVersion() UnpairedVersion { - return nil -} - -type Version interface { - Constraint -} - -type UnpairedVersion interface { - Version -} - -var _ Constraint = UnpairedVersion(nil) - - -// derived test case from issue #21804 - -type ( - _ interface{ m(B1) } - A1 interface{ a(D1) } - B1 interface{ A1 } - C1 interface{ B1 } - D1 interface{ C1 } -) - -var _ A1 = C1(nil) - - -// derived test case from issue #22701 - -func F(x I4) interface{} { - return x.Method() -} - -type Unused interface { - RefersToI1(a I1) -} - -type I1 interface { - I2 - I3 -} - -type I2 interface { - RefersToI4() I4 -} - -type I3 interface { - Method() interface{} -} - -type I4 interface { - I1 -} - - -// check embedding of error interface - -type Error interface{ error } - -var err Error -var _ = err.Error() - - -// more esoteric cases - -type ( - T1 interface { T2 } - T2 /* ERROR "invalid recursive type" */ T2 -) - -type ( - T3 interface { T4 } - T4 /* ERROR "invalid recursive type" */ T5 - T5 = T6 - T6 = T7 - T7 = T4 -) - - -// arbitrary code may appear inside an interface - -const n = unsafe.Sizeof(func(){}) - -type I interface { - m([unsafe.Sizeof(func() { I.m(nil, [n]byte{}) })]byte) -} - - -// test cases for varias alias cycles - -type T10 /* ERROR "invalid recursive type" */ = *T10 // issue #25141 -type T11 /* ERROR "invalid recursive type" */ = interface{ f(T11) } // issue #23139 - -// issue #18640 -type ( - aa = bb - bb struct { - *aa - } -) - -type ( - a struct{ *b } - b = c - c struct{ *b } -) - -// issue #24939 -type ( - _ interface { - M(P) - } - - M interface { - F() P - } - - P = interface { - I() M - } -) - -// issue #8699 -type T12 /* ERROR "invalid recursive type" */ [len(a12)]int -var a12 = makeArray() -func makeArray() (res T12) { return } - -// issue #20770 -var r = newReader() -func newReader() r // ERROR "r (package-level variable) is not a type" - -// variations of the theme of #8699 and #20770 -var arr /* ERROR "cycle" */ = f() -func f() [len(arr)]int - -// issue #25790 -func ff(ff /* ERROR "not a type" */ ) -func gg((gg /* ERROR "not a type" */ )) - -type T13 /* ERROR "invalid recursive type T13" */ [len(b13)]int -var b13 T13 - -func g1() [unsafe.Sizeof(g1)]int -func g2() [unsafe.Sizeof(x2)]int -var x2 = g2 - -// verify that we get the correct sizes for the functions above -// (note: assert is statically evaluated in go/types test mode) -func init() { - assert(unsafe.Sizeof(g1) == 8) - assert(unsafe.Sizeof(x2) == 8) -} - -func h() [h /* ERROR "no value" */ ()[0]]int { panic(0) } - -var c14 /* ERROR "cycle" */ T14 -type T14 [uintptr(unsafe.Sizeof(&c14))]byte - -// issue #34333 -type T15 /* ERROR "invalid recursive type T15" */ struct { - f func() T16 - b T16 -} - -type T16 struct { - T15 -}
\ No newline at end of file diff --git a/src/internal/types/testdata/fixedbugs/issue46461.go b/src/internal/types/testdata/fixedbugs/issue46461.go index 454f7e8365..8bf31090b8 100644 --- a/src/internal/types/testdata/fixedbugs/issue46461.go +++ b/src/internal/types/testdata/fixedbugs/issue46461.go @@ -1,5 +1,3 @@ -// -gotypesalias=0 - // Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue46461a.go b/src/internal/types/testdata/fixedbugs/issue46461a.go deleted file mode 100644 index 74ed6c4882..0000000000 --- a/src/internal/types/testdata/fixedbugs/issue46461a.go +++ /dev/null @@ -1,22 +0,0 @@ -// -gotypesalias=1 - -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package p - -// test case 1 -type T[U interface{ M() T[U] }] int - -type X int - -func (X) M() T[X] { return 0 } - -// test case 2 -type A[T interface{ A[T] }] interface{} - -// test case 3 -type A2[U interface{ A2[U] }] interface{ M() A2[U] } - -type I interface{ A2[I]; M() A2[I] } diff --git a/src/internal/types/testdata/fixedbugs/issue47968.go b/src/internal/types/testdata/fixedbugs/issue47968.go index e260c63a76..b748651428 100644 --- a/src/internal/types/testdata/fixedbugs/issue47968.go +++ b/src/internal/types/testdata/fixedbugs/issue47968.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue50729b.go b/src/internal/types/testdata/fixedbugs/issue50729b.go index bc1f4406e5..76959c2f26 100644 --- a/src/internal/types/testdata/fixedbugs/issue50729b.go +++ b/src/internal/types/testdata/fixedbugs/issue50729b.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue50779.go b/src/internal/types/testdata/fixedbugs/issue50779.go index 59c0f2d6a0..6306df65f4 100644 --- a/src/internal/types/testdata/fixedbugs/issue50779.go +++ b/src/internal/types/testdata/fixedbugs/issue50779.go @@ -1,5 +1,3 @@ -// -gotypesalias=0 - // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -17,7 +15,7 @@ type R[S any, P any] struct{} type SR = R[SS, ST] type SS interface { - NSR(any) *SR // ERROR "invalid use of type alias SR in recursive type" + NSR(any) *SR } type C interface { diff --git a/src/internal/types/testdata/fixedbugs/issue50779a.go b/src/internal/types/testdata/fixedbugs/issue50779a.go deleted file mode 100644 index d0e99058b7..0000000000 --- a/src/internal/types/testdata/fixedbugs/issue50779a.go +++ /dev/null @@ -1,25 +0,0 @@ -// -gotypesalias=1 - -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package p - -type AC interface { - C -} - -type ST []int - -type R[S any, P any] struct{} - -type SR = R[SS, ST] - -type SS interface { - NSR(any) *SR -} - -type C interface { - NSR(any) *SR -} diff --git a/src/internal/types/testdata/fixedbugs/issue65854.go b/src/internal/types/testdata/fixedbugs/issue65854.go index 744777a94f..8fdd3ae94a 100644 --- a/src/internal/types/testdata/fixedbugs/issue65854.go +++ b/src/internal/types/testdata/fixedbugs/issue65854.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue67628.go b/src/internal/types/testdata/fixedbugs/issue67628.go index dff1bee4a0..cd45cd61b9 100644 --- a/src/internal/types/testdata/fixedbugs/issue67628.go +++ b/src/internal/types/testdata/fixedbugs/issue67628.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue67683.go b/src/internal/types/testdata/fixedbugs/issue67683.go index c9ad5f6788..fbad886331 100644 --- a/src/internal/types/testdata/fixedbugs/issue67683.go +++ b/src/internal/types/testdata/fixedbugs/issue67683.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue69576.go b/src/internal/types/testdata/fixedbugs/issue69576.go index fc436bbfd3..1bc9b4ee33 100644 --- a/src/internal/types/testdata/fixedbugs/issue69576.go +++ b/src/internal/types/testdata/fixedbugs/issue69576.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue69955.go b/src/internal/types/testdata/fixedbugs/issue69955.go index 68ddf4108c..01a5d95262 100644 --- a/src/internal/types/testdata/fixedbugs/issue69955.go +++ b/src/internal/types/testdata/fixedbugs/issue69955.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue70417.go b/src/internal/types/testdata/fixedbugs/issue70417.go index 74bdea3b8a..683df3a503 100644 --- a/src/internal/types/testdata/fixedbugs/issue70417.go +++ b/src/internal/types/testdata/fixedbugs/issue70417.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue71198.go b/src/internal/types/testdata/fixedbugs/issue71198.go index 479f8e2b0c..f2dcc9828a 100644 --- a/src/internal/types/testdata/fixedbugs/issue71198.go +++ b/src/internal/types/testdata/fixedbugs/issue71198.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/fixedbugs/issue75885.go b/src/internal/types/testdata/fixedbugs/issue75885.go index f0cf4a65ed..77f220b87a 100644 --- a/src/internal/types/testdata/fixedbugs/issue75885.go +++ b/src/internal/types/testdata/fixedbugs/issue75885.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/spec/receivers.go b/src/internal/types/testdata/spec/receivers.go index 010c5511c1..0df1bfd6cc 100644 --- a/src/internal/types/testdata/spec/receivers.go +++ b/src/internal/types/testdata/spec/receivers.go @@ -1,5 +1,3 @@ -// -gotypesalias=1 - // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/src/internal/types/testdata/spec/typeAliases1.23b.go b/src/internal/types/testdata/spec/typeAliases1.23.go index 8a09899066..061792974d 100644 --- a/src/internal/types/testdata/spec/typeAliases1.23b.go +++ b/src/internal/types/testdata/spec/typeAliases1.23.go @@ -1,4 +1,4 @@ -// -lang=go1.23 -gotypesalias=1 +// -lang=go1.23 // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/internal/types/testdata/spec/typeAliases1.23a.go b/src/internal/types/testdata/spec/typeAliases1.23a.go deleted file mode 100644 index 0ea21a4e32..0000000000 --- a/src/internal/types/testdata/spec/typeAliases1.23a.go +++ /dev/null @@ -1,10 +0,0 @@ -// -lang=go1.23 -gotypesalias=0 - -// Copyright 2024 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package aliasTypes - -type _ = int -type _ /* ERROR "generic type alias requires GODEBUG=gotypesalias=1" */ [P any] = int |
