From: Ian Lance Taylor Date: Thu, 2 Dec 2021 22:52:31 +0000 (-0800) Subject: builtin: document "any" and "comparable" X-Git-Tag: go1.18beta1~108 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=098599003ba78225152d22984f82f78892221dad;p=gostls13.git builtin: document "any" and "comparable" Fixes #49927 Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/368954 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Robert Griesemer TryBot-Result: Gopher Robot --- diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index 01190e9900..9a94c7357d 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -91,6 +91,16 @@ type byte = uint8 // used, by convention, to distinguish character values from integer values. type rune = int32 +// any is an alias for interface{} and is equivalent to interface{} in all ways. +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). +// The comparable interface may only be used as a type parameter constraint, +// not as the type of a variable. +type comparable comparable + // iota is a predeclared identifier representing the untyped integer ordinal // number of the current const specification in a (usually parenthesized) // const declaration. It is zero-indexed.