]> Cypherpunks repositories - gostls13.git/commitdiff
spec: adjust representability rules for type parameters
authorRobert Griesemer <gri@golang.org>
Sat, 20 Nov 2021 21:29:02 +0000 (13:29 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 24 Nov 2021 20:53:29 +0000 (20:53 +0000)
Change-Id: I4423a059527066c4418c195911f8184dfd3f5a15
Reviewed-on: https://go-review.googlesource.com/c/go/+/365914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
doc/go_spec.html

index 176e1a755d8038acfb14f6636fc789b1df61f4b7..186600f0150bfa1075f420983a44684e9d2484b9 100644 (file)
@@ -1876,7 +1876,9 @@ by a value of type <code>T</code>.
 
 <p>
 A <a href="#Constants">constant</a> <code>x</code> is <i>representable</i>
-by a value of type <code>T</code> if one of the following conditions applies:
+by a value of type <code>T</code>,
+where <code>T</code> is not a <a href="#Type_parameters">type parameter</a>,
+if one of the following conditions applies:
 </p>
 
 <ul>
@@ -1899,6 +1901,12 @@ are representable by values of <code>T</code>'s component type (<code>float32</c
 </li>
 </ul>
 
+<p>
+If <code>T</code> is a type parameter with <a href="#Structure_of_interfaces">specific types</a>,
+<code>x</code> is representable by a value of type <code>T</code> if <code>x</code> is representable
+by a value of each specific type of <code>T</code>.
+</p>
+
 <pre>
 x                   T           x is representable by a value of T because