aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile
diff options
context:
space:
mode:
authorRobert Griesemer <gri@google.com>2025-10-15 11:27:17 -0700
committerRobert Griesemer <gri@google.com>2025-10-15 13:46:26 -0700
commit31f82877e85a7e6c70b0104e704abfed622e345f (patch)
treec2889d1eec9ff1990d2b20aa53fde494551c4bc4 /src/cmd/compile
parent6346349f5629a5767d2cd132f01092857a570bd2 (diff)
downloadgo-31f82877e85a7e6c70b0104e704abfed622e345f.tar.xz
go/types, types2: fix misleading internal comment
See also the discussion in #75885. Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d Reviewed-on: https://go-review.googlesource.com/c/go/+/712141 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd/compile')
-rw-r--r--src/cmd/compile/internal/types2/decl.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go
index 4ebd945407..22fccc1519 100644
--- a/src/cmd/compile/internal/types2/decl.go
+++ b/src/cmd/compile/internal/types2/decl.go
@@ -575,11 +575,8 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *TypeN
named.underlying = Typ[Invalid]
}
- // Disallow a lone type parameter as the RHS of a type declaration (go.dev/issue/45639).
- // We don't need this restriction anymore if we make the underlying type of a type
- // parameter its constraint interface: if the RHS is a lone type parameter, we will
- // use its underlying type (like we do for any RHS in a type declaration), and its
- // underlying type is an interface and the type declaration is well defined.
+ // spec: "In a type definition the given type cannot be a type parameter."
+ // (See also go.dev/issue/45639.)
if isTypeParam(rhs) {
check.error(tdecl.Type, MisplacedTypeParam, "cannot use a type parameter as RHS in type declaration")
named.underlying = Typ[Invalid]