Fix "analysis failed but no diagnostics were emitted" panics#534
Merged
sbillig merged 1 commit intoargotorg:masterfrom Sep 6, 2021
Merged
Fix "analysis failed but no diagnostics were emitted" panics#534sbillig merged 1 commit intoargotorg:masterfrom
sbillig merged 1 commit intoargotorg:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #534 +/- ##
==========================================
+ Coverage 87.68% 87.73% +0.04%
==========================================
Files 87 87
Lines 5670 5674 +4
==========================================
+ Hits 4972 4978 +6
+ Misses 698 696 -2
Continue to review full report at Codecov.
|
31491b1 to
af8e7df
Compare
sbillig
commented
Sep 5, 2021
af8e7df to
996a784
Compare
cburgdorf
approved these changes
Sep 6, 2021
Collaborator
cburgdorf
left a comment
There was a problem hiding this comment.
Great hardening of the error system.
| /// a `TypeError`. So that the rust compiler can help us enforce this rule, a `TypeError` | ||
| /// cannot be constructed without providing a [`DiagnosticVoucher`]. A voucher can be obtained | ||
| /// by calling an error function on an [`AnalyzerContext`](crate::context::AnalyzerContext). | ||
| /// Please don't try to work around this restriction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was wrong?
closes #532 - Here we weren't emitting an error message if the
Stringtype constructor was ill-formed. EgString<x>("hi")would be rejected without an error message.closes #530 - Here we were panicking because the fn body diagnostic vec was empty, even though the analysis failed. We shouldn't panic in this case, because an undefined type diagnostic was produced elsewhere (during the analysis of the function signature).
These cases are just symptoms of a problem in the analyzer; we require that a friendly diagnostic be emitted before returning FatalError or TypeError, but can't effectively ensure that that's happening.
How was it fixed?
FatalError and TypeError now can't be created unless you have a voucher proving that you've emitted a diagnostic. You can receive such a voucher by calling an
AnalyzerContexterror function. For example:I noticed some other error stuff that needs to be improved, and added TODO comments. I'll fix those in a follow-up PR.
To-Do