-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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.IsInterface "Named.check == nil but type is incomplete" panic in methodsets.EnsurePointer #69537
Comments
This is liable to be very hard to track down without a reproducer. I'm glad we have this assertion. Some brief notes, from refreshing my memory:
So, once type checking or importing exits, all types should either have non-Named underlying, or be an unexpanded instance of a type that has a non-Named underlying. That's how it's supposed to work. Aliases add a layer of complexity, but shouldn't be relevant to [email protected] (which does not have the Go 1.23.1 language version). Therefore, it's concerning that there must really be something we've missed here. One possibility is a path to A good next step might be to add some earlier assertions of the invariants described above. |
Another potential category of bug would be some sort of ordering bug, such that the instance is expanded after it has been cleaned up. But this logic is meant to prevent such a scenario: whenever the named type is expanded, it is verified that it either has non-named underlying OR is still yet to be cleaned up (check != nil => not cleaned up yet). |
Ah, I wonder if this could actually be a dupe of #68877. Could it be that someone built gopls with the explicit |
Absent more information, I think we should assume this is a dupe of #68877. We should reopen only if this occurs with go1.23.1 or later. |
Issue created by stacks.
The Named type passed to IsInterface has an Underlying type that is also a Named (indicating type checking is incomplete) yet the original Named (which may or may not be the same) has Named.check==nil (indicating type checking should be complete). This seems like a go/types bug.
This stack
pY1Q7g
was reported by telemetry:crash/crash
runtime.gopanic:+69
go/types.(*Named).under:+21
go/types.under:+2
go/types.IsInterface:=111
golang.org/x/tools/gopls/internal/cache/methodsets.EnsurePointer:+1
golang.org/x/tools/gopls/internal/cache/methodsets.methodSetInfo:+4
golang.org/x/tools/gopls/internal/cache/methodsets.(*indexBuilder).build:+35
golang.org/x/tools/gopls/internal/cache/methodsets.NewIndex:=82
golang.org/x/tools/gopls/internal/cache.(*syntaxPackage).methodsets.func1:+1
sync.(*Once).doSlow:+5
sync.(*Once).Do:=67
golang.org/x/tools/gopls/internal/cache.(*syntaxPackage).methodsets:+1
golang.org/x/tools/gopls/internal/cache.storePackageResults:+3
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).handleSyntaxPackage.gowrap1:+0
runtime.goexit:+0
The text was updated successfully, but these errors were encountered: