]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] 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)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 11 Mar 2022 00:01:01 +0000 (00:01 +0000)
commita0c7e2620a11daa26345ed4ae5c4f7edca2ba95a
treeae22e794a1c2ac58073631426dfb7125bb8a9afd
parentc6b5b7e6e5cc5f406f6c4ec88305ad801117e8d6
[release-branch.go1.18] 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>
(cherry picked from commit 3a5e3d8173df547d8360a609097fc80f01182db1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/391357
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Robert Griesemer <gri@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