#!stacks
"types.assert" && "validType0:+92"
Issue created by stacks.
func (check *Checker) validType0(pos token.Pos, typ Type, nest, path []*Named) bool {
... switch t := typ.(type) {
case *Named:
... // If the current type t is also found in nest, (the memory of) t is
// embedded in itself, indicating an invalid recursive type.
for _, e := range nest {
if Identical(e, t) {
// We have a cycle. If t != t.Origin() then t is an instance of
// the generic type t.Origin(). Because t is in the nest, t must
// occur within the definition (RHS) of the generic type t.Origin(),
// directly or indirectly, after expansion of the RHS.
// Therefore t.Origin() must be invalid, no matter how it is
// instantiated since the instantiation t of t.Origin() happens
// inside t.Origin()'s RHS and thus is always the same and always
// present.
// Therefore we can mark the underlying of both t and t.Origin()
// as invalid. If t is not an instance of a generic type, t and
// t.Origin() are the same.
// Furthermore, because we check all types in a package for validity
// before type checking is complete, any exported type that is invalid
// will have an invalid underlying type and we can't reach here with
// such a type (invalid types are excluded above).
// Thus, if we reach here with a type t, both t and t.Origin() (if
// different in the first place) must be from the current package;
// they cannot have been imported.
// Therefore it is safe to change their underlying types; there is
// no chance for a race condition (the types of the current package
// are not yet available to other goroutines).
assert(t.obj.pkg == check.pkg) // FAIL
assert(t.Origin().obj.pkg == check.pkg)
This stack mQWoXg was reported by telemetry:
crash/crash
runtime.gopanic:+70,+0x16e
go/types.(*Checker).handleBailout:+25,+0x90
go/types.(*Checker).Files.deferwrap1:+0,+0x1a
runtime.gopanic:+51,+0x139
go/types.assert:+8,+0x53
go/types.(*Checker).validType0:+92,+0x699
go/types.(*Checker).validType0:+41,+0x3b0
go/types.(*Checker).validType0:+118,+0x944
go/types.(*Checker).validType0:+41,+0x3b0
go/types.(*Checker).validType0:+118,+0x944
go/types.(*Checker).validType0:+27,+0x5bc
go/types.(*Checker).validType0:+118,+0x944
go/types.(*Checker).validType0:+27,+0x5bc
go/types.(*Checker).validType0:+118,+0x944
go/types.(*Checker).validType:=17,+0xcb
go/types.(*Checker).typeDecl.func1:+2,+0xaa
go/types.(*Checker).processDelayed:+18,+0x1e1
golang.org/x/tools/gopls@v0.21.1 go1.26.0 windows/amd64 gopls.client=vscode (2)
Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=windows GOARCH=amd64 GOTOOLCHAIN=go1.26.0 go install golang.org/x/tools/gopls@v0.21.1 && find $HOME/go/bin -type f)
To disassemble: go tool objdump exe | less
Issue created by stacks.
This stack
mQWoXgwas reported by telemetry:crash/crashruntime.gopanic:+70,+0x16ego/types.(*Checker).handleBailout:+25,+0x90go/types.(*Checker).Files.deferwrap1:+0,+0x1aruntime.gopanic:+51,+0x139go/types.assert:+8,+0x53go/types.(*Checker).validType0:+92,+0x699go/types.(*Checker).validType0:+41,+0x3b0go/types.(*Checker).validType0:+118,+0x944go/types.(*Checker).validType0:+41,+0x3b0go/types.(*Checker).validType0:+118,+0x944go/types.(*Checker).validType0:+27,+0x5bcgo/types.(*Checker).validType0:+118,+0x944go/types.(*Checker).validType0:+27,+0x5bcgo/types.(*Checker).validType0:+118,+0x944go/types.(*Checker).validType:=17,+0xcbgo/types.(*Checker).typeDecl.func1:+2,+0xaago/types.(*Checker).processDelayed:+18,+0x1e1Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=windows GOARCH=amd64 GOTOOLCHAIN=go1.26.0 go install golang.org/x/tools/gopls@v0.21.1 && find $HOME/go/bin -type f)To disassemble:
go tool objdump exe | less