-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/gopls: types.Func.typ=nil panic in missingMethod with gopls@master built with go@master #59848
Comments
Thanks @timothy-king! This may be a type-checker regression, or related to the fact that we import invalid packages from export data. I'll investigate. CC @adonovan @griesemer for awareness. I'll transfer to the Go issue tracker. |
I wonder if this is dup of #59371, which was just fixed. What exact version of GOROOT are you using? I can't relate the stack trace to the source. Specifically:
this frame currently contains a plain return statement (in a function that doesn't use defer), and rolling back recent commits don't make it line up either:
[EDIT: never mind, I see that it's go@ ac571a3, and it does line up] |
The panic is caused by Func.typ=nil in funcString when missingMethod tries to print the wrongName reason for the failed assignment to a nontrivial interface type. The syntax must be something like |
wrongName can only happen in one case where a function f is found with a folded-case name that matches. |
Or a receiver type that lacks a pointer, I think. |
From looking at this, I think I could be mistaken, but I think the |
Hah, well I should have looked at the importer before making this assertion. I must be mistaken: it is even easier to see that the indexed importer cannot produce a Func without a signature ( |
@griesemer and I both have no ideas how to proceed; let's move this to the v0.13.0 milestone, as I don't think we'll be able to figure it out without more data. |
We had two google-internal reproducers of this crash, not using gopls, albeit with slightly different call stacks (but still in initVar). @griesemer and @adonovan I CCed you on those internal issues. Therefore, I think this is a go/types regression related to the recent refactoring of assignability. Moving into the go1.21 milestone. |
Tentatively marking this as a release blocker. There was a new internal google toolchain release to our internal infrastructure yesterday, and two crashes overnight suggests to me that this is a frequent enough crash pattern to block the release. |
Oh. This shouldn't have been this complicated. missingMethod logic was refactored in https://go.dev/cl/472637 and subsequent. It looks like there is a way to miss the objDecl call, here: Note that in the wrongName case, we skip the objDecl call. Now to construct a reproducer. |
Simple repro:
|
Change https://go.dev/cl/494615 mentions this issue: |
gopls version: v0.0.0-20230404161500-4d205d81b5a0 (devel go1.21-ac571a388dc Mon Apr 3 20:17:02 2023 0000)
gopls flags:
update flags: proxy
extension version: 0.38.0
go version: devel 1.21-ac571a388dc
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Thu, 20 Apr 2023 19:39:00 GMT
restart history:
Wed, 19 Apr 2023 21:24:47 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.
NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
<OPTIONAL: ATTACH LOGS HERE>
The text was updated successfully, but these errors were encountered: