If we nest matches, the dedent after the nested is consumed, meaning that the expression of the next match arm comes immediately after (without a dedent in between), meaning that is is interpreted as a call (left is match, right is expression of next arm).
One fix to this was always following dedents by a newline.
However, this resulted in the issue where the parser had no way of detecting, for instance, an else in an if statement after a block, as this was hiding behind a newline, as opposed to immediately following a dedent.
Therefore, it might be time to reconsider the grammar and how if statements operate.
Description of Bug
If we nest matches, the dedent after the nested is consumed, meaning that the expression of the next match arm comes immediately after (without a dedent in between), meaning that is is interpreted as a call (left is match, right is expression of next arm).
One fix to this was always following dedents by a newline. However, this resulted in the issue where the parser had no way of detecting, for instance, an else in an if statement after a block, as this was hiding behind a newline, as opposed to immediately following a dedent. Therefore, it might be time to reconsider the grammar and how if statements operate.
How to Reproduce
match
statementmatch
match
by another armExpected behavior
The nested match should be its own expression.
Additional context
...