Skip to content

Commit 0985990

Browse files
builtin: document "any" and "comparable"
Fixes #49927 Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/368954 Trust: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 8da66a3 commit 0985990

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/builtin/builtin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ type byte = uint8
9191
// used, by convention, to distinguish character values from integer values.
9292
type rune = int32
9393

94+
// any is an alias for interface{} and is equivalent to interface{} in all ways.
95+
type any = interface{}
96+
97+
// comparable is an interface that is implemented by all comparable types
98+
// (booleans, numbers, strings, pointers, channels, interfaces,
99+
// arrays of comparable types, structs whose fields are all comparable types).
100+
// The comparable interface may only be used as a type parameter constraint,
101+
// not as the type of a variable.
102+
type comparable comparable
103+
94104
// iota is a predeclared identifier representing the untyped integer ordinal
95105
// number of the current const specification in a (usually parenthesized)
96106
// const declaration. It is zero-indexed.

0 commit comments

Comments
 (0)