diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-12-02 14:52:31 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-12-03 01:09:21 +0000 |
commit | 098599003ba78225152d22984f82f78892221dad (patch) | |
tree | ced222107c7e46480f1069ea4b55df33c4b94ae0 /src/builtin | |
parent | 8da66a35cab2de4f7ce0215c47929be624eeb03d (diff) | |
download | go-098599003ba78225152d22984f82f78892221dad.tar.gz go-098599003ba78225152d22984f82f78892221dad.zip |
builtin: document "any" and "comparable"
Fixes #49927
Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/368954
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/builtin')
-rw-r--r-- | src/builtin/builtin.go | 10 |
1 files changed, 10 insertions, 0 deletions
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. |