]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: pointer base types cannot be type constraints
authorRobert Griesemer <gri@golang.org>
Wed, 9 Mar 2022 22:27:25 +0000 (14:27 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 9 Mar 2022 23:21:06 +0000 (23:21 +0000)
commit3a5e3d8173df547d8360a609097fc80f01182db1
treefc387b0e341e7126109f1fab40a9ffd6c1efcd67
parente189b5e06d4831025758c0b152838fa1a0375525
go/types, types2: pointer base types cannot be type constraints

Pointer types may appear in expressions *P and we don't know if
we have an indirection (P is a pointer value) or a pointer type
(P is a type) until we type-check P. Don't forget to check that
a type P must be an ordinary (not a constraint) type in this
special case.

Fixes #51578.

Change-Id: If782cc6dd2a602a498574c78c99e40c3b72274a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391275
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue51578.go2 [new file with mode: 0644]
src/cmd/compile/internal/types2/typexpr.go
src/go/types/expr.go
src/go/types/testdata/fixedbugs/issue51578.go2 [new file with mode: 0644]
src/go/types/typexpr.go