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

Refactor how diagnostics are pushed through incremental; add queries.AST #404

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mcy
Copy link
Member

@mcy mcy commented Dec 19, 2024

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-feeling report.AsError type. But this is unnecessary ceremony: all that NonFatal 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 with Task.Report, which is a report included with each task. When Run 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.

@mcy mcy requested a review from jhump December 19, 2024 23:20
@jhump
Copy link
Member

jhump commented Dec 20, 2024

Mind fixing the CI test failures? I often don't start a review when CI is red because I think you might still be actively working on the branch.

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

Successfully merging this pull request may close these issues.

2 participants