Repository navigation
refactor(interpreter): read analysis results through one view - #853
Merged
Merged
Conversation
- Updated the analysis methods in the interpreter to return `Analyzed` states instead of raw results, enhancing clarity and consistency. - Modified tests to accommodate the new analysis result structure, ensuring that the response extraction aligns with the updated API. - Removed deprecated code related to previous analysis result handling, streamlining the codebase. - Adjusted documentation to reflect changes in the analysis API and its usage across various modules.
zhenrongliew
requested review from
Roger-luo,
alexcgatea and
planza-quera
and
a balanced review from Copilot
November 10, 2026 16:36
alexcgatea
requested changes
Nov 10, 2026
alexcgatea
self-requested a review
November 11, 2026 15:48
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.
One read-only way to read converged facts from all three abstract engines (constprop, demand, liveness).
analyzenow returnsAnalyzed<Engine>: the converged state of exactly oneanalysis. It cannot run again, so every analysis is fresh and has one root.
AnalysisResults, implemented onAnalyzedfor each engine:root,contexts,callable_of,fact,facts,responsecallables,contexts_of,joined,joined_facts,joined_responseresponse(ctx)is what a context answers its caller: constprop's returnproduct, demand's parameter facts,
Nonefor liveness.Motivation
Engines computed facts for every value in every context, but clients could read only the root's result, through three different APIs, two of which copied. Constprop exposed no per-value facts at all.
Example
Constprop:
A context distinguishes a callable by its argument values.
Within each pair context,
fact(context, value)andresponse(context)give:Demand:
The first call needs
%p; the second needs%q:joined_fact(pair, value)combines demand across contexts: a value is live if any context needs it. Here, every value in pair is live in the combined result.