-
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, types2: index out of range panic in Checker.arguments #61931
Comments
Thanks very much for the repro! This appears to be a type-checker bug. |
@gopherbot please backport this to 1.21; it is a type checker and compiler panic. |
Backport issue(s) opened: #61932 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Bisected to https://go.dev/cl/495395 |
Simpler reproducer (for go/types): package p
func A(func(any), ...any) {}
func B[T any](T) {}
func _() {
A(B, nil
} Run as |
The optimization "Optimization: Only if the callee's parameter list was adjusted do we need to..." in call.go seems incorrect. If we always do it, the crash disappears. Investigating. |
The crash was self explanatory, I thought: previously we would exit early if type parameters did not match signature. It is another question how the code should be optimally structured... |
It's just the normal arguments (not the type arguments); and we exited early if some of the arguments were invalid (not because their number was incorrect). That check simply hid another bug (which doesn't appear with types2 because the syntax parser produces a different syntax tree in this case). So this is worth getting to the bottom of it. |
Change https://go.dev/cl/519456 mentions this issue: |
gopls version: (devel) (go1.21.0) (built from 47c5305)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.21.0
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Thu, 10 Aug 2023 15:53:47 GMT
restart history:
Thu, 10 Aug 2023 15:33:15 GMT: activation (enabled: true)
Thu, 10 Aug 2023 15:52:58 GMT: manual (enabled: true)
Thu, 10 Aug 2023 15:53:29 GMT: manual (enabled: true)
Here is a minimal program that can reproduce the bug. Deleting the last ')' on line 8 will cause gopls to crash.
The text was updated successfully, but these errors were encountered: