From: Robert Griesemer Date: Thu, 24 Feb 2022 23:45:11 +0000 (-0800) Subject: doc/go1.18: document method set limitation for method selectors X-Git-Tag: go1.18~33^2~18 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b8b3196375e6b5275ae05eba8ca04662f10ab047;p=gostls13.git doc/go1.18: document method set limitation for method selectors For #51183. For #47694. Change-Id: If47ae074c3cd9f73b2e7f6408749d9a7d56bd8d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/387924 Trust: Robert Griesemer Reviewed-by: Ian Lance Taylor --- diff --git a/doc/go1.18.html b/doc/go1.18.html index bc29ed4afe..53e9d9b258 100644 --- a/doc/go1.18.html +++ b/doc/go1.18.html @@ -135,6 +135,16 @@ Do not send CLs removing the interior tags from such phrases. the predeclared functions real, imag, and complex. We hope to remove this restriction in Go 1.19. +
  • + The Go compiler currently only supports calling a method m on a value + x of type parameter type P if m is explictly + declared by P's constraint interface. + Similarly, method values x.m and method expressions + P.m also are only supported if m is explicitly + declared by P, even though m might be in the method set + of P by virtue of the fact that all types in P implement + m. We hope to remove this restriction in Go 1.19. +
  • Embedding a type parameter, or a pointer to a type parameter, as an unnamed field in a struct type is not permitted. Similarly,