Open
Description
A struct type with a missing close brace has an StructType.End pos of zero. That means the enclosing nodes such as ReturnStmt may also have a computed End that is zero, or perhaps slightly larger:
I believe this is the root cause of at least some of the many gopls crashes recorded in #64547.
Ultimately this is a problem of parser error recovery. We need to establish the invariants that:
- all tree nodes have valid Pos/End positions; and
- all tree nodes have nested Pos/End subranges (with a possible exception for the func keyword in FuncDecl/FuncType).
See also: