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

go/types: panic in error reporting for invalid use of "init" [1.17 only] #48082

Closed
findleyr opened this issue Aug 30, 2021 · 4 comments
Closed

go/types: panic in error reporting for invalid use of "init" [1.17 only] #48082

findleyr opened this issue Aug 30, 2021 · 4 comments

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Aug 30, 2021

The fix in CL 324732 on the dev.typeparams branch should have been back-ported to 1.17, but was missed.

This can result in a panic in go/types when type checking the following invalid code

package p

import "init"

Please consider this for back-port to the next 1.17 minor release.

CC @griesemer @golang/release

@heschi heschi added this to the Go1.17.1 milestone Aug 30, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Aug 30, 2021

Change https://golang.org/cl/346309 mentions this issue: go/types: add a test for invalid import of "init"

Loading

gopherbot pushed a commit that referenced this issue Aug 30, 2021
This error reporting code path did not have test coverage, and panics in
1.17 (filed as #48082).

Add a test that would have reproduced the panic, for both go/types and
cmd/compile/internal/types2.

Change-Id: Icd5f54f8407e4ab57d432f44a129ecf6b2755feb
Reviewed-on: https://go-review.googlesource.com/c/go/+/346309
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
@findleyr
Copy link
Contributor Author

@findleyr findleyr commented Sep 1, 2021

Though this panic should be rare, it has manifested at least once in in a vscode-go gopls crash report, and in a Google internal crash report. It is a regression, and in my opinion is worth fixing for 1.17.1. Marked as a release blocker to make sure it is not missed in any case.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 1, 2021

Change https://golang.org/cl/347071 mentions this issue: [release-branch.go1.17] go/types: fix panic with nil package name

Loading

gopherbot pushed a commit that referenced this issue Sep 1, 2021
This is a straightforward port of CL 320490 to go/types.

Fixes #48082

Change-Id: I763c806c777f926a563d8f9384764e5b3f7f083c
Reviewed-on: https://go-review.googlesource.com/c/go/+/324732
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit e32fab1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/347071
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 1, 2021

Closed by merging 678b07d to release-branch.go1.17.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants