1
0
mirror of https://github.com/golang/go synced 2024-11-19 09:24:39 -07:00
go/doc
Robert Griesemer 083ef54624 spec: fix conversion rules (match implementation)
As written, the conversion P(x), where P and the type
of x are type parameters with identical underlying types
(i.e., identical constraints), is valid. However, unless
the type of x and P are identical (which is covered with
the assignability rule), such a conversion is not valid
in general (consider the case where both type parameters
are different type parameters with constraint "any").

This change adjusts the rules to prohibit type parameters
in this case. The same reasoning applies and the analogue
change is made for pointer types.

The type checker already implements these updated rules.

Change-Id: Id90187900cb2820f6a0a0cf582cf26cdf8addbce
Reviewed-on: https://go-review.googlesource.com/c/go/+/371074
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-13 18:41:35 +00:00
..
asm.html doc/asm: fix HTML markup 2021-09-10 17:15:37 +00:00
go1.17_spec.html spec: fix a broken link 2021-11-11 19:44:13 +00:00
go1.18.html doc: document cmd/vet changes for 1.18 release 2021-12-10 19:26:50 +00:00
go_mem.html doc/mem: remove unnecessary pre tags within same snippet 2020-03-03 09:28:34 +00:00
go_spec.html spec: fix conversion rules (match implementation) 2021-12-13 18:41:35 +00:00