fix(chunker): clear stale symbols after scope ends - #23
Draft
JohnXu22786 wants to merge 4 commits into
Draft
JohnXu22786 wants to merge 4 commits into
JohnXu22786 wants to merge 4 commits into
Conversation
Prevent completed brace-scoped symbols from labeling following top-level statements, and cover the regression with a focused chunker test.
Keep symbol lifetime aligned with lexical braces, enclosing scopes, and expression-bodied declarations so following code gets the correct label.
Prevent stale symbol labels across multiline expressions, nested lexical constructs, and Python or Ruby scope boundaries.
Preserve language-specific lexical state so comments, literals, multiline declarations, and bodyless symbols cannot leak stale labels into following code.
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.
What this PR does
Before this PR:
Chunk symbols could remain active after a function ended. Lexical braces in comments, templates, regexes, shell parameter expansions, Ruby literals, or heredocs could corrupt scope depth; nested symbols could lose their enclosing scope; and multiline, bodyless, or indentation-sensitive declarations could label following statements.
After this PR:
Chunking preserves nested lexical and language-specific state across lines, including comments, templates, regexes, Bash parameter expansions, Ruby heredocs, Python headers/comments, and nested symbol scopes. It recognizes syntax-based multiline expression termination and bodyless Kotlin, Scala, and Swift declarations. Following top-level statements now receive the correct symbol label. Focused regressions cover all reported edge cases.
Type of change
Bug fix
Breaking changes (if any)
None.