parser: detect mismatched/misleading indentation #14484
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #35. This is a follow-up to #13593, which explains some of the design choice rationale.
I added two compile error tests, one for each of the new kinds of error. If the errors were "recoverable" it could be done in one, but I need to study parse.zig more to understand how to make parse errors recoverable. Let me know if that's desirable.
I found a TODO in parser_test.zig (added in 79f1876) which suggests that a fix to #35 should allow for a particular recoverable error scenario with closing curly braces. I don't 100% understand the expectation, so please let me know what it means if it is still a relevant blocker.