Skip to content

fix: add TermInfo for mut vars in ControlStack.stateT.runInBase#12661

Merged
sgraf812 merged 1 commit intomasterfrom
sg/fix-unused-var-try-catch
Feb 23, 2026
Merged

fix: add TermInfo for mut vars in ControlStack.stateT.runInBase#12661
sgraf812 merged 1 commit intomasterfrom
sg/fix-unused-var-try-catch

Conversation

@sgraf812
Copy link
Copy Markdown
Contributor

This PR fixes false-positive "unused variable" warnings for mutable variables reassigned inside try/catch blocks with the new do elaborator.

The root cause was that ControlStack.stateT.runInBase packed mutable variables into a state tuple without calling Term.addTermInfo', so the unused variable linter could not see that the variables were used. The fix mirrors how the for loop elaborator handles the same pattern in useLoopMutVars.

🤖 Generated with Claude Code

@sgraf812 sgraf812 added the changelog-no Do not include this PR in the release changelog label Feb 23, 2026
@sgraf812 sgraf812 changed the base branch from sg/newdo-core to master February 23, 2026 19:03
@sgraf812 sgraf812 added changelog-language Language features and metaprograms and removed changelog-no Do not include this PR in the release changelog labels Feb 23, 2026
@sgraf812 sgraf812 enabled auto-merge February 23, 2026 19:04
@sgraf812 sgraf812 disabled auto-merge February 23, 2026 19:04
This PR fixes false-positive "unused variable" warnings for mutable
variables reassigned inside `try`/`catch` blocks with the new do
elaborator. The root cause was that `ControlStack.stateT.runInBase`
packed mutable variables into a state tuple without calling
`Term.addTermInfo'`, so the unused variable linter could not see that
the variables were used. The fix mirrors how the `for` loop elaborator
handles the same pattern in `useLoopMutVars`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sgraf812 sgraf812 force-pushed the sg/fix-unused-var-try-catch branch from 6d61743 to 778ffd2 Compare February 23, 2026 19:04
@sgraf812 sgraf812 enabled auto-merge February 23, 2026 19:05
@sgraf812 sgraf812 added this pull request to the merge queue Feb 23, 2026
Merged via the queue into master with commit 65e5053 Feb 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant