Trying to parse the LSP specification vscode-languageserver-node/protocol/metaModel.json at main · microsoft/vscode-languageserver-node · GitHub using core:encoding/json.unmarshal() I ended up with this gem of a model:
Type :: struct {
kind: string,
name: Maybe(string),
element: Maybe(Type),
items: Maybe([]Type),
}
The compiler dev-2026-10:84bc3fc21 segfaults on this. This is understandable (though an error message would be better) because this struct is self-referencing and has an infinite size. Question is, how do I break the loop? The corresponding JSON might look like this, literally the first example from the spec:
{
"kind": "or",
"items": [
{
"kind": "reference",
"name": "Definition"
},
{
"kind": "array",
"element": {
"kind": "reference",
"name": "DefinitionLink"
}
},
{
"kind": "base",
"name": "null"
}
]
}
I tried to replace element: Maybe(Type) with element: Maybe(^Type) but that failed to parse with Unsupported_Type_Error.