mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
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>
This commit is contained in:
parent
61011de1af
commit
9e29dd42df
|
@ -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 -->
|
||||
|
|
Loading…
Reference in a new issue