Fix "analysis failed but no diagnostics were emitted" panics #534
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
String
type 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
AnalyzerContext
error 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