[go] builtin: clarify that interface types do not implement comparable

288 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
Feb 8, 2022, 4:11:35 PM2/8/22
to Robert Griesemer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Robert Griesemer.

Ian Lance Taylor would like Robert Griesemer to review this change.

View Change

builtin: clarify that interface types do not implement comparable

Fixes #51083

Change-Id: Ic9207ae4104b06749925186e0eb4f18edf1b5007
---
M src/builtin/builtin.go
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go
index 08ae7ed..5657be4 100644
--- a/src/builtin/builtin.go
+++ b/src/builtin/builtin.go
@@ -95,11 +95,11 @@
type any = interface{}

// comparable is an interface that is implemented by all comparable types
-// (booleans, numbers, strings, pointers, channels, interfaces,
-// arrays of comparable types, structs whose fields are all comparable types).
+// (booleans, numbers, strings, pointers, channels, arrays of comparable types,
+// structs whose fields are all comparable types).
// The comparable interface may only be used as a type parameter constraint,
// not as the type of a variable.
-type comparable comparable
+type comparable interface{ comparable }

// iota is a predeclared identifier representing the untyped integer ordinal
// number of the current const specification in a (usually parenthesized)

To view, visit change 384235. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ic9207ae4104b06749925186e0eb4f18edf1b5007
Gerrit-Change-Number: 384235
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
Gerrit-Attention: Robert Griesemer <g...@golang.org>
Gerrit-MessageType: newchange

Robert Griesemer (Gerrit)

unread,
Feb 8, 2022, 4:51:37 PM2/8/22
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor.

Patch set 1:Code-Review +2

View Change

    To view, visit change 384235. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic9207ae4104b06749925186e0eb4f18edf1b5007
    Gerrit-Change-Number: 384235
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Comment-Date: Tue, 08 Feb 2022 21:51:34 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment
    Reply all
    Reply to author
    Forward
    0 new messages