Refactor how diagnostics are pushed through incremental
; add queries.AST
#404
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.
The
NonFatal
functionality of the incremental package has proven to be a poor abstraction. What I essentially wanted was a way to have queries generate diagnostics, which I could then deduplicate and collect in the end.Collecting diagnostics from dependencies is incorrect, because A -> B, A -> C, B -> D, C -> D would mean diagnostics for D contain the diagnostics from A twice. The rough idea was to instead stash reports in the
NonFatal
area, which required the somewhat unnatural-feelingreport.AsError
type. But this is unnecessary ceremony: all thatNonFatal
will ever be used for is for stashing reports, so the incremental framework should Just Do That. It's not a general library, after all.This PR replaces
Task.NonFatal
withTask.Report
, which is a report included with each task. WhenRun
completes, it collects the set of all queries that were computed (possibly from cache) and merges their reports, and sorts it to eliminate non-determinism.It is not immediately clear to me if having tasks return
(v T, fatal error)
is still useful. Perhaps(v T, ok bool)
may be more appropriate, since that error should be logged as a diagnostic and will probably just get thrown away.