Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet, x/tools/internal/typeparams: consider type sets of named constraints #49597

Closed
findleyr opened this issue Nov 15, 2021 · 2 comments
Closed

Comments

@findleyr
Copy link
Contributor

Due to a bug (a missing call to Underlying() 馃う), the type set normalization API we're using for vet analyzers doesn't handle named constraints properly. It just so happens that all our test cases use inlined interfaces...

The fix is trivial, but this should be a release-blocker. Opening this issue to track vendoring the fix in std.

CC @griesemer @timothy-king

@findleyr findleyr added this to the Go1.18 milestone Nov 15, 2021
@gopherbot
Copy link

Change https://golang.org/cl/363982 mentions this issue: internal/typeparams: normalize the underlying constraint interface

gopherbot pushed a commit to golang/tools that referenced this issue Nov 16, 2021
A call to Underlying() was missing from the computation of a type
parameter's structural terms, resulting in incorrect results for type
parameters with defined constraints. This wasn't caught because all
analyzer tests use inlined interfaces out of convenience, and the
fallback behavior for vet analyzers using this API is to fail silently.

Fix this, and add tests that would have failed. Also update the
normalization tests to use the StructuralTerms API, and delete the
earlier NormalizeInterface API. StructuralTerms has proven to be more
useful.

For clarity, change the StructuralTerms function to accept a *TypeParam
rather than arbitrary Type, and significantly revamp its docstring.

Updates golang/go#49597

Change-Id: I8b863604655b44b943e6afbd5d22a66f44260d10
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363982
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/363986 mentions this issue: all: update vendored golang.org/x/tools

@golang golang locked and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants