Skip to content

fix(chunker): clear stale symbols after scope ends - #23

Draft
JohnXu22786 wants to merge 4 commits into
mainfrom
bug/chunker-clear-stale-symbol-labels
Draft

JohnXu22786 wants to merge 4 commits into
mainfrom
bug/chunker-clear-stale-symbol-labels

Conversation

@JohnXu22786

@JohnXu22786 JohnXu22786 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

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.

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.
@JohnXu22786 JohnXu22786 changed the title fix(chunker): clear stale symbols after block end fix(chunker): clear stale symbols after scope ends Sep 12, 2026
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.
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.

1 participant