diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index d3637584fe990..bcfb7ce956320 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -227,6 +227,15 @@ func real(c ComplexType) FloatType // the type of c. func imag(c ComplexType) FloatType +// The clear built-in function clears maps and slices. +// For maps, clear deletes all entries, resulting in an empty map. +// For slices, clear sets all elements up to the length of the slice +// to the zero value of the respective element type. If the argument +// type is a type parameter, the type parameter's type set must +// contain only map or slice types, and clear performs the operation +// implied by the type argument. +func clear[T ~[]Type | ~map[Type]Type1](t T) + // The close built-in function closes a channel, which must be either // bidirectional or send-only. It should be executed only by the sender, // never the receiver, and has the effect of shutting down the channel after