Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEmit fewer errors after parse errors #48724
Comments
estebank
added
C-enhancement
A-diagnostics
A-parser
labels
Mar 4, 2018
estebank
referenced this issue
Dec 7, 2018
Closed
Gracefully handle missing comma between struct style enum variants #56579
estebank
referenced this issue
Jan 12, 2019
Merged
Modify some parser diagnostics to continue evaluating beyond the parser #57540
Centril
added a commit
to Centril/rust
that referenced
this issue
Jan 14, 2019
Centril
added a commit
to Centril/rust
that referenced
this issue
Jan 14, 2019
Centril
added a commit
to Centril/rust
that referenced
this issue
Jan 14, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
estebank commentedMar 4, 2018
In cases of parse errors, many times we continue checking the code generating errors that would be fixed if the syntax was corrected. We should be more proactive in detecting elements that were "recovered" during parsing, in the same spirit as #46732.
It is particularly bad when encountering unenclosed delimiters. On this, the parser should try some really conservative local recovery (simple substitutions) and unless the rest of the code successfully compiles, the parser should discard the rest of the code until it finds a closing curly brace at the beggining of the line or EOF. This assumes that the likelihood of the following code being correct and usable is high. This type of recovery might still fail during typeck as, for example, methods might be missing. If this is the case, the
implblock in the AST should be marked as "recovered" and during typeck avoid emitting errors related to it.