-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: assertion failure in recent range statement checking logic #68334
Comments
@griesemer this recent panic appears to occur in logic that was recently back-ported to 1.22: https://go.dev/cl/580937. The assertion failure is here:
|
@lmorg if you happen to recall any details about the range statement you were editing at the time of this panic, that would be helpful, but in any case we should be able to find the logical flaw (I'll note that this assertion was discussed in code review; we must have missed something). @griesemer tentatively assigning to you for further investigation. I can also take a look, but will first be busy with #68311. The bug may be easy to spot--I did not attempt. |
Actually, I think I'll be able to get to this sooner than @griesemer. CC @timothy-king for awareness: Tim, I'll ask you to review! :) |
@findleyr I can't say for 100% certain but looking at the commit times on the project I was working on, and corrolating that to the report time of this issue, I'd guess it was this one: |
Sorry, this one: https://github.com/lmorg/murex/blob/37b8ce0c539eefce7c6deadb28f9bc2d51a5e39a/builtins/core/modules/cmd-list.go#L95 lmorg/murex@37b8ce0#diff-aa1232e0202826677facafef616e8f6fc85f672ff6749e4a77cd7503e70ac33e I cannot replicate the issue though. |
edit: Nope. That wasn't it.
|
Change https://go.dev/cl/597356 mentions this issue: |
@gopherbot please backport this issue to 1.22. It is a regression in the latest patch release and causes crashes in gopls. |
Backport issue(s) opened: #68370 (for 1.22). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Not technically a release blocker since this is already released in 1.22.5, but we should fix for 1.23 and backport. Thanks @timothy-king for investigating. |
Thanks both. I appreciate there wasn't much to go on for this particular issue (sorry about that) |
@lmorg your time to file the issue is greatly appreciated. No need to apologize. |
Fixes an assertion failure in Checker.rangeStmt that range over int only has a key type and no value type. When allowVersion failed, rangeKeyVal returns Typ[Invalid] for the value instead of nil. When Config.Error != nil, rangeStmt proceeded. The check for rhs[1]==nil was not enough to catch this case. It must also check rhs[1]== Updates #68334 Change-Id: Iffa1b2f7b6a94570ec50b8c6603e727a45ba3357 Reviewed-on: https://go-review.googlesource.com/c/go/+/597356 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/598055 mentions this issue: |
Change https://go.dev/cl/598055 mentions this issue: |
Closing as I believe this is fixed (in go@master). The backport issue will be closed when 1.22.6 is released. Thanks @timothy-king for the fix. |
…er int is not permitted Fixes an assertion failure in Checker.rangeStmt that range over int only has a key type and no value type. When allowVersion failed, rangeKeyVal returns Typ[Invalid] for the value instead of nil. When Config.Error != nil, rangeStmt proceeded. The check for rhs[1]==nil was not enough to catch this case. It must also check rhs[1]== Fixes #68334 Fixes #68370 Change-Id: Iffa1b2f7b6a94570ec50b8c6603e727a45ba3357 Reviewed-on: https://go-review.googlesource.com/c/go/+/597356 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> (cherry picked from commit 4e77872) Reviewed-on: https://go-review.googlesource.com/c/go/+/598055
gopls version: v0.16.1/go1.22.5
gopls flags:
update flags: proxy
extension version: 0.41.4
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Fri, 05 Jul 2024 22:28:48 GMT
restart history:
Fri, 05 Jul 2024 21:41:59 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
gopls stats -anon
{ "DirStats": { "Files": 1984, "TestdataFiles": 5, "GoFiles": 1083, "ModFiles": 1, "Dirs": 235 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.5", "GoplsVersion": "v0.16.1", "InitialWorkspaceLoadDuration": "1.169338542s", "MemStats": { "HeapAlloc": 60239376, "HeapInUse": 106414080, "TotalAlloc": 703540872 }, "WorkspaceStats": { "Files": { "Total": 2250, "Largest": 5748466, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.5", "AllPackages": { "Packages": 742, "LargestPackage": 155, "CompiledGoFiles": 3962, "Modules": 26 }, "WorkspacePackages": { "Packages": 271, "LargestPackage": 63, "CompiledGoFiles": 1417, "Modules": 1 }, "Diagnostics": 0 } ] } }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: