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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet, go/types: go vet crash when using self-recursive anonymous types in constraints [1.18 backport] #51727

Closed
gopherbot opened this issue Mar 16, 2022 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@findleyr requested issue #51717 to be considered for backport to the next 1.18 minor release.

@gopherbot please backport this to 1.18, it is an infinite recursion when running cmd/vet on valid code.

@gopherbot
Copy link
Author

Change https://go.dev/cl/393635 mentions this issue: go/types/objectpath: break cycles through type parameters in find

@toothrot toothrot added the CherryPickApproved Used during the release process for point releases label Mar 23, 2022
@toothrot
Copy link
Contributor

Approved. This is a serious issue with no workaround.

@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Mar 23, 2022
gopherbot pushed a commit to golang/tools that referenced this issue Mar 29, 2022
When searching for objects, we naively traversed through type parameter
constraints. This leads to infinite recursion when there are cycles
through type parameter constraints.

Break these cycles by tracking type parameter names that have previously
been encountered. This ensures we walk type parameter constraints at
most once. Note that if the desired object was not found on the first
search of the constraint, there is no need to search again.

Note: this cherry-pick also adjusts a test error message to match
go1.18.

Updates golang/go#51727

Change-Id: Ifcdf4b138a0e95441e485bbb9ee21c01b04eaed4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/393376
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit d67eab4)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/393635
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@gopherbot
Copy link
Author

Change https://go.dev/cl/397476 mentions this issue: [release-branch.go1.18] all update vendored golang.org/x/tools

@gopherbot
Copy link
Author

Closed by merging 6ebf676 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Apr 4, 2022
Update x/tools from internal-branch.go1.18-vendor to pick up the
cherry-picked fix for #51727.

The following commands were used, from the cmd module:
  go get -d golang.org/x/tools@internal-branch.go1.18-vendor
  go mod tidy
  go mod vendor

Fixes #51727

Change-Id: I380a66fee585c8c12f9646de87ffb5e398b4ba80
Reviewed-on: https://go-review.googlesource.com/c/go/+/397476
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
@golang golang locked and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants