Repository navigation
Conversation
lewis6991
force-pushed
the
rewrite-common-reentry
branch
6 times, most recently
from
October 16, 2026 16:57
855312a to
4528244
Compare
lewis6991
marked this pull request as draft
October 16, 2026 23:41
lewis6991
force-pushed
the
rewrite-common-reentry
branch
3 times, most recently
from
October 17, 2026 20:36
2b5e9a1 to
04046ba
Compare
Member
|
We should also change crates\emmylua_code_analysis\src\semantic_model\access.rs |
lewis6991
force-pushed
the
rewrite-common-reentry
branch
3 times, most recently
from
October 18, 2026 11:24
6b22f00 to
8ec14d5
Compare
Dependent semantic queries can revisit unfinished work. A provisional
fallback can then be cached as a final answer, which makes later queries
depend on evaluation order. Recursive expression and type evaluation can
also overflow the native stack.
Query caching
Publish in-progress entries before calling dependencies and release
cache borrows before those calls. Track results that read unfinished
work as provisional. Reuse them within the outer query, then discard
them so a later query can retry. Publish dependent cache entries only
when their inputs are complete. Preserve the existing seeds for
recursive inference.
Type evaluation
Use a work list for alias instantiation and conditional continuations.
Share the active alias path across nested semantic queries, and release
it before independent branches. Resolve outer type computations while
keeping fields and array elements lazy. Substitute member arguments at
lookup, then evaluate the result where it is consumed. This supports
recursive data types without unfolding their complete structure.
Use work lists for long flow-expression chains, alias index keys, and
operator forwarding. Share type reconstruction and named substitution
between evaluation, generic result cleanup, and rendering.
Type comparison
Replace the recursive depth guard with a dependency graph and work
queue. Keep matches, mismatches, and unresolved comparisons distinct.
Recheck parents when a dependency changes. Accept a recursive assumption
only when the cycle passes through data constructors, then finish
dependent checks before publishing the result. Alias forwarding alone is
no proof.
A complete union alternative can prove a match despite an unresolved
alternative. A definite mismatch can reject a required set of checks
despite another unfinished check. Keep conditional types deferred when
neither outcome is proven, including during conditional inference.
Resource exhaustion
Exact cycle checks cannot stop computations whose arguments keep
growing:
---@alias Input<T> Filter<Input<T[]>>
---@alias Filter<T> T extends string and T or T[]
Share a work budget across alias evaluation and type comparison. Retain
a stack guard for nested semantic calls that still use native recursion.
Report exhaustion with a type-complexity diagnostic instead of treating
it as a type mismatch. Keep unrelated queries and diagnostics available.
Coverage
Cover recursive JSON types, structural cycles with mismatched fields,
shrinking and finitely changing arguments, growing computations, query
order, and independent branches. Check long valid alias, expression, and
comparison chains, plus deferred conditionals and unrelated diagnostics.
lewis6991
force-pushed
the
rewrite-common-reentry
branch
from
October 18, 2026 13:46
8ec14d5 to
db7b451
Compare
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.
Dependent semantic queries can revisit unfinished work. A provisional
fallback can then be cached as a final answer, which makes later queries
depend on evaluation order. Recursive expression and type evaluation can
also overflow the native stack.
Query caching
Publish in-progress entries before calling dependencies and release
cache borrows before those calls. Track results that read unfinished
work as provisional. Reuse them within the outer query, then discard
them so a later query can retry. Publish dependent cache entries only
when their inputs are complete. Preserve the existing seeds for
recursive inference.
Type evaluation
Use a work list for alias instantiation and conditional continuations.
Share the active alias path across nested semantic queries, and release
it before independent branches. Resolve outer type computations while
keeping fields and array elements lazy. Substitute member arguments at
lookup, then evaluate the result where it is consumed. This supports
recursive data types without unfolding their complete structure.
Use work lists for long flow-expression chains, alias index keys, and
operator forwarding. Share type reconstruction and named substitution
between evaluation, generic result cleanup, and rendering.
Type comparison
Replace the recursive depth guard with a dependency graph and work
queue. Keep matches, mismatches, and unresolved comparisons distinct.
Recheck parents when a dependency changes. Accept a recursive assumption
only when the cycle passes through data constructors, then finish
dependent checks before publishing the result. Alias forwarding alone is
no proof.
A complete union alternative can prove a match despite an unresolved
alternative. A definite mismatch can reject a required set of checks
despite another unfinished check. Keep conditional types deferred when
neither outcome is proven, including during conditional inference.
Resource exhaustion
Exact cycle checks cannot stop computations whose arguments keep
growing:
Share a work budget across alias evaluation and type comparison. Retain
a stack guard for nested semantic calls that still use native recursion.
Report exhaustion with a type-complexity diagnostic instead of treating
it as a type mismatch. Keep unrelated queries and diagnostics available.
Coverage
Cover recursive JSON types, structural cycles with mismatched fields,
shrinking and finitely changing arguments, growing computations, query
order, and independent branches. Check long valid alias, expression, and
comparison chains, plus deferred conditionals and unrelated diagnostics.