]> Cypherpunks repositories - gostls13.git/commitdiff
spec: remove restriction on channel element types for close built-in (bug fix)
authorRobert Griesemer <gri@google.com>
Tue, 2 Dec 2025 22:32:13 +0000 (14:32 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 2 Dec 2025 23:07:19 +0000 (15:07 -0800)
The spec states that if the argument type for close is a type parameter,
it's type set must only contain channels and they must all have the same
element type. This latter requirement (all must have the same element
type) was never enforced by the compiler, nor is it important for
correctness or required by the implementation.

This change removes this requirement also in the spec and thus
documents what was always (since 1.18) the case.

Fixes #74034.

Change-Id: If65d50bfb581b7f37999413088d3d3b1820e054a
Reviewed-on: https://go-review.googlesource.com/c/go/+/725923
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
doc/go_spec.html

index b129520180d97417a0f9a4279eaeaaf13a2661e1..f47f5a6e3e26dfc6ac3e230565d23dcba583dea1 100644 (file)
@@ -7496,7 +7496,7 @@ returns a received value along with an indication of whether the channel is clos
 <p>
 If the type of the argument to <code>close</code> is a
 <a href="#Type_parameter_declarations">type parameter</a>,
-all types in its type set must be channels with the same element type.
+all types in its type set must be channels.
 It is an error if any of those channels is a receive-only channel.
 </p>