langium
langium copied to clipboard
`Maximum call stack size exceeded` because of missing assignments
Langium version: 2.0.1
Steps To Reproduce
I tried to create a new grammar, copy-pasting from an ANTLR grammar. I was about to assign property names. The first rule in this playground link is missing these property names.
Bad: entry Collection: '['(ElementCollection(',' ElementCollection)*)?']';
Good: entry Collection: '['(elements+=ElementCollection(',' elements+=ElementCollection)*)?']';
The current behavior
By adding names, the error disappears. But without, I get an Unhandled Promise Rejection: RangeError: Maximum call stack size exceeded. and a took a while to find the trigger for this error.
The expected behavior
It would be good to have some pointer, what is wrong or which rule caused this stack overflow. After some attempts of debugging, I just guessed to add more assignments.
We could show an error in the grammar editor when you write an unassigned rule call with * or + multiplicity. I can't imagine any case where that would be useful.
Unfortunately, I discovered that my validation rule breaks the correct domainmodel and requirements examples:
For both data type rules, and cross-references, the call to the ID terminal rule causes an error that shouldn't be there.
These errors also appeared in the lint job of the build pipeline, but did not cause the pipeline to fail: https://github.com/eclipse-langium/langium/actions/runs/8239259881/job/22532070389 I'll open an issue so that this CI problem will be fixed.