aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2021-12-07 14:29:21 -0500
committerRobert Findley <rfindley@google.com>2021-12-08 21:21:44 +0000
commit9e29dd42df18141506dcfc2513e8a653564fdbf1 (patch)
tree1bad807e00ee7d13ce9d589e591d9ed43a307145 /doc
parent61011de1af0bc6ab286c4722632719d3da2cf746 (diff)
downloadgo-9e29dd42df18141506dcfc2513e8a653564fdbf1.tar.gz
go-9e29dd42df18141506dcfc2513e8a653564fdbf1.zip
doc: document cmd/vet changes for generics in 1.18
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/go1.18.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/go1.18.html b/doc/go1.18.html
index a3c2da059b..2813ddc12c 100644
--- a/doc/go1.18.html
+++ b/doc/go1.18.html
@@ -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 -->