]> Cypherpunks repositories - gostls13.git/commitdiff
doc: document cmd/vet changes for generics in 1.18
authorRobert Findley <rfindley@google.com>
Tue, 7 Dec 2021 19:29:21 +0000 (14:29 -0500)
committerRobert Findley <rfindley@google.com>
Wed, 8 Dec 2021 21:21:44 +0000 (21:21 +0000)
Fixes #50011
Updates #47694

Change-Id: Id3d43f2f72de61b360b79c2b375ca1372d5f4692
Reviewed-on: https://go-review.googlesource.com/c/go/+/369979
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
doc/go1.18.html

index a3c2da059bce7d3606f7de78d4aeb112dc01ba4a..2813ddc12c11b9c1b1873043ae3cbf2a5bea9581 100644 (file)
@@ -266,6 +266,28 @@ Do not send CLs removing the interior tags from such phrases.
   multiple CPUs, <code>gofmt</code> should now be significantly faster.
 </p>
 
+<h3 id="vet"><code>vet</code></h3>
+
+<h4 id="vet-generics">Updates for Generics</h4>
+
+<p><!-- https://golang.org/issue/48704 -->
+       The <code>vet</code> tool is updated to support generic code. In most cases,
+       it reports an error in generic code whenever it would report an error in the
+       equivalent non-generic code after substituting for type parameters with a
+       type from their
+       <a href="https://golang.org/ref/spec#Interface_types">type set</a>.
+
+       For example, <code>vet</code> reports a format error in
+       <pre>func Print[T ~int|~string](t T) {
+       fmt.Printf("%d", t)
+}</pre>
+       because it would report a format error in the non-generic equivalent of
+       <code>Print[string]</code>:
+       <pre>func PrintString(x string) {
+       fmt.Printf("%d", x)
+}</pre>
+</p>
+
 <h2 id="runtime">Runtime</h2>
 
 <p><!-- https://golang.org/issue/44167 -->