Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recovered parse errors should fail compilation #4259

Closed
josh11b opened this issue Aug 27, 2024 · 1 comment · Fixed by #4261
Closed

Recovered parse errors should fail compilation #4259

josh11b opened this issue Aug 27, 2024 · 1 comment · Fixed by #4261
Assignees

Comments

@josh11b
Copy link
Contributor

josh11b commented Aug 27, 2024

Description of the bug:

Some errors, such as missing or additional whitespace next to an operator, are recovered by the compiler. In this case, the compiler outputs a diagnostic, but no parse nodes are marked as having an error, and so the compilation succeeds.

What did you do, or what's a simple way to reproduce the bug?

This problem can be seen in any of the files starting with recover_ in the
toolchain/parse/testdata/operators/ directory.

What did you expect to happen?

Those tests should only pass with a filename (or split filename) starting with fail_. We need some way to indicate an error in the parse output (like I believe exists for the lex output) even when there are no nodes with an error in the output parse tree.

What actually happened?

Those files have diagnostics with a CHECK:STDERR prefix, but the parse stage succeeds.

@josh11b josh11b added toolchain good first issue Possibly a good first issue for newcomers labels Aug 27, 2024
@jonmeow jonmeow removed the good first issue Possibly a good first issue for newcomers label Aug 27, 2024
@jonmeow jonmeow self-assigned this Aug 27, 2024
@jonmeow
Copy link
Contributor

jonmeow commented Aug 27, 2024

There are a few problems here, notably that pattern matching doesn't correctly diagnose issues. Since this is a bit more nuanced, I don't think it's a good first issue. I'll just take care of it.

github-merge-queue bot pushed a commit that referenced this issue Aug 27, 2024
This is a minimal fix to consistently diagnose when producing erroneous
nodes. Leaving a TODO in handle_match

Caught while investigating #4259
github-merge-queue bot pushed a commit that referenced this issue Aug 28, 2024
This is how we are setting has_errors_ in other stages; this should only
make parse consistent.

Fixes #4259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants