]> Cypherpunks repositories - gostls13.git/commit
spec: adjust rule for type parameter on RHS of alias declaration
authorRobert Griesemer <gri@google.com>
Tue, 18 Nov 2025 23:47:44 +0000 (15:47 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 20 Nov 2025 18:25:17 +0000 (10:25 -0800)
commit790384c6c23f7ce44199ea3cd61c856d632b08aa
tree04d6b61b6eca359cbfffc62371d56bd78fb02159
parenta49b0302d0e1d97b67a5f3f3beceafdcbc4c2ef0
spec: adjust rule for type parameter on RHS of alias declaration

Per discussion on issue #75885, a type parameter on the RHS of an alias
declaration must not be declared in the same declaration (but it may be
declared by an enclosing function). This relaxes the spec slightly and
allows for (pre-existing) test cases.

Add a corresponding check to the type checker (there was no check for
type parameters on the RHS of alias declarations at all, before).

Fixes #75884.
Fixes #75885.

Change-Id: I1e5675978e6423d626c068829d4bf5e90035ea82
Reviewed-on: https://go-review.googlesource.com/c/go/+/721820
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
doc/go_spec.html
src/cmd/compile/internal/types2/decl.go
src/go/types/decl.go
src/internal/types/testdata/fixedbugs/issue75885.go [new file with mode: 0644]