1
0
mirror of https://github.com/golang/go synced 2024-11-07 00:46:20 -07:00

builtin: clarify that interface types do not implement comparable

Fixes #51083

Change-Id: Ic9207ae4104b06749925186e0eb4f18edf1b5007
Reviewed-on: https://go-review.googlesource.com/c/go/+/384235
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Ian Lance Taylor 2022-02-08 13:11:09 -08:00
parent 275aedccd4
commit f524a2baa4

View File

@ -95,11 +95,11 @@ type rune = int32
type any = interface{} type any = interface{}
// comparable is an interface that is implemented by all comparable types // comparable is an interface that is implemented by all comparable types
// (booleans, numbers, strings, pointers, channels, interfaces, // (booleans, numbers, strings, pointers, channels, arrays of comparable types,
// arrays of comparable types, structs whose fields are all comparable types). // structs whose fields are all comparable types).
// The comparable interface may only be used as a type parameter constraint, // The comparable interface may only be used as a type parameter constraint,
// not as the type of a variable. // not as the type of a variable.
type comparable comparable type comparable interface{ comparable }
// iota is a predeclared identifier representing the untyped integer ordinal // iota is a predeclared identifier representing the untyped integer ordinal
// number of the current const specification in a (usually parenthesized) // number of the current const specification in a (usually parenthesized)