[go] go/types, types2: fix misleading internal comment

0 views
Skip to first unread message

Robert Griesemer (Gerrit)

unread,
2:29 PM (9 hours ago) 2:29 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Robert Griesemer has uploaded the change for review

Commit message

go/types, types2: fix misleading internal comment

See also the discussion in #75885.
Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d

Change diff

diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go
index 4ebd945..22fccc1 100644
--- a/src/cmd/compile/internal/types2/decl.go
+++ b/src/cmd/compile/internal/types2/decl.go
@@ -575,11 +575,8 @@
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]
diff --git a/src/go/types/decl.go b/src/go/types/decl.go
index aef7f6a..13d9d9c 100644
--- a/src/go/types/decl.go
+++ b/src/go/types/decl.go
@@ -657,11 +657,8 @@
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]

Change information

Files:
  • M src/cmd/compile/internal/types2/decl.go
  • M src/go/types/decl.go
Change size: S
Delta: 2 files changed, 4 insertions(+), 10 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
Gerrit-Change-Number: 712141
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Robert Griesemer (Gerrit)

unread,
2:30 PM (9 hours ago) 2:30 PM
to goph...@pubsubhelper.golang.org, Mark Freeman, Robert Findley, golang-co...@googlegroups.com
Attention needed from Mark Freeman

Robert Griesemer voted

Auto-Submit+1
Code-Review+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Mark Freeman
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
Gerrit-Change-Number: 712141
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-CC: Robert Findley <rfin...@google.com>
Gerrit-Attention: Mark Freeman <markf...@google.com>
Gerrit-Comment-Date: Wed, 15 Oct 2025 18:30:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Robert Griesemer (Gerrit)

unread,
2:45 PM (9 hours ago) 2:45 PM
to goph...@pubsubhelper.golang.org, Go LUCI, Mark Freeman, Robert Findley, golang-co...@googlegroups.com
Attention needed from Mark Freeman

Robert Griesemer voted and added 1 comment

Votes added by Robert Griesemer

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Robert Griesemer . resolved

Unrelated. This CL just changes an internal comment.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Freeman
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
Gerrit-Change-Number: 712141
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-CC: Robert Findley <rfin...@google.com>
Gerrit-Attention: Mark Freeman <markf...@google.com>
Gerrit-Comment-Date: Wed, 15 Oct 2025 18:45:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Mark Freeman (Gerrit)

unread,
2:46 PM (9 hours ago) 2:46 PM
to Robert Griesemer, goph...@pubsubhelper.golang.org, Go LUCI, Robert Findley, golang-co...@googlegroups.com
Attention needed from Robert Griesemer

Mark Freeman voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Robert Griesemer
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
Gerrit-Change-Number: 712141
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-CC: Robert Findley <rfin...@google.com>
Gerrit-Attention: Robert Griesemer <g...@google.com>
Gerrit-Comment-Date: Wed, 15 Oct 2025 18:46:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Robert Griesemer (Gerrit)

unread,
4:46 PM (7 hours ago) 4:46 PM
to goph...@pubsubhelper.golang.org, Mark Freeman, Go LUCI, Robert Findley, golang-co...@googlegroups.com

Robert Griesemer voted and added 1 comment

Votes added by Robert Griesemer

TryBot-Bypass+1

1 comment

Patchset-level comments
Robert Griesemer . resolved

Failure is unrelated. Ok to submit.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
    Gerrit-Change-Number: 712141
    Gerrit-PatchSet: 1
    Gerrit-Owner: Robert Griesemer <g...@google.com>
    Gerrit-Reviewer: Mark Freeman <markf...@google.com>
    Gerrit-Reviewer: Robert Griesemer <g...@google.com>
    Gerrit-CC: Robert Findley <rfin...@google.com>
    Gerrit-Comment-Date: Wed, 15 Oct 2025 20:46:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Robert Griesemer (Gerrit)

    unread,
    4:46 PM (7 hours ago) 4:46 PM
    to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Mark Freeman, Go LUCI, Robert Findley, golang-co...@googlegroups.com

    Robert Griesemer submitted the change

    Change information

    Commit message:
    go/types, types2: fix misleading internal comment

    See also the discussion in #75885.
    Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
    Reviewed-by: Mark Freeman <markf...@google.com>
    Auto-Submit: Robert Griesemer <g...@google.com>
    TryBot-Bypass: Robert Griesemer <g...@google.com>
    Reviewed-by: Robert Griesemer <g...@google.com>
    Files:
    • M src/cmd/compile/internal/types2/decl.go
    • M src/go/types/decl.go
    Change size: S
    Delta: 2 files changed, 4 insertions(+), 10 deletions(-)
    Branch: refs/heads/master
    Submit Requirements:
    • requirement satisfiedCode-Review: +2 by Mark Freeman, +1 by Robert Griesemer
    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI, TryBot-Bypass+1 by Robert Griesemer
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
    Gerrit-Change-Number: 712141
    Gerrit-PatchSet: 2
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages