-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types, types: gopls crash in unification #50929
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
Comments
CC @griesemer I have not yet reproduced this, but the Go version here is recent (https://go.dev/cl/360615), so I don't think this crash is fixed. That call stack indicates that this crash can occur during normal type checking. |
Confirmed that this repros in go/types without gopls. Here is a smaller repro: package p
type RC[G any, RG any] interface {}
type RG[G any] struct{}
type NFn[Rc RC[G, RG], G any, RG any] func(Rc)
func NC[Rc RC[G, RG], G any, RG any](nFn NFn[Rc, G, RG]) {
}
func _[Rc RC[RG], RG any]() {
var nFn NFn[Rc, RG]
NC(nFn)
} |
Ok, minimal repro:
|
Thanks, @findleyr . I will take this on. |
Thanks @findleyr I had tried to make my example more minimal but the error kept going away. Glad you were able to make it smaller! |
@virtuald thanks very much for filing the report, and no need to make it perfectly minimal. It's really helpful to get crashers in any form. In this case the type of x is invalid (with an incorrect number of type arguments), and it looks like the type checker asserts that such a type can never get to unification. |
Change https://golang.org/cl/382076 mentions this issue: |
gopls version: v0.7.5
gopls flags:
update flags: proxy
extension version: 0.31.0
go version: devel go1.18-a5c0b19
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Mon, 31 Jan 2022 05:48:23 GMT
restart history:
Sun, 30 Jan 2022 07:58:26 GMT: activation (enabled: true)
Mon, 31 Jan 2022 04:48:18 GMT: manual (enabled: true)
Mon, 31 Jan 2022 04:49:33 GMT: installation (enabled: true)
Mon, 31 Jan 2022 04:49:39 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:35:21 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:36:46 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:43:01 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:43:44 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:45:49 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:46:28 GMT: manual (enabled: true)
Mon, 31 Jan 2022 05:47:49 GMT: manual (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
It crashes pretty consistently when I restart with this file loaded:
In particular, the crash has something to do with adding that G marked in the diff. Without it, no crash. With it, crashes every time.
The text was updated successfully, but these errors were encountered: