From: Robert Findley Date: Tue, 7 Dec 2021 19:29:21 +0000 (-0500) Subject: doc: document cmd/vet changes for generics in 1.18 X-Git-Tag: go1.18beta1~41 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9e29dd42df18141506dcfc2513e8a653564fdbf1;p=gostls13.git 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 Run-TryBot: Robert Findley TryBot-Result: Gopher Robot Reviewed-by: Tim King --- 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, gofmt should now be significantly faster.

+

vet

+ +

Updates for Generics

+ +

+ The vet 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 + type set. + + For example, vet reports a format error in +

func Print[T ~int|~string](t T) {
+	fmt.Printf("%d", t)
+}
+ because it would report a format error in the non-generic equivalent of + Print[string]: +
func PrintString(x string) {
+	fmt.Printf("%d", x)
+}
+

+

Runtime