From 30cbebca96d9099f67a7dfc7650357aa19d6b810 Mon Sep 17 00:00:00 2001 From: apocelipes Date: Thu, 12 Dec 2024 17:35:21 +0800 Subject: [PATCH] builtin: document clear is a no-op if its argument's value is nil Just like the builtin function delete's comment does. --- src/builtin/builtin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index 215c59c4ae..af01aea5dd 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -247,7 +247,7 @@ func imag(c ComplexType) FloatType // 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. +// implied by the type argument. If t is nil, clear is a no-op. func clear[T ~[]Type | ~map[Type]Type1](t T) // The close built-in function closes a channel, which must be either