Warning 20 range: also walk through let/use bindings (follow-up to #19504)#19896
Merged
Conversation
- Walk through let/use bindings in addition to Sequential when locating
the offending expression for warning 20. Fixes the case Eugene flagged:
for _ in [] do
let x = 1
x
- Fix wrong issue link (#5735 -> #5418) in code comment, release notes,
and test annotations.
- Add regression tests for the let/use case (single + nested bindings).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
abonie
reviewed
Jun 8, 2026
abonie
left a comment
Member
There was a problem hiding this comment.
🤖 AI-generated review — verify before acting on findings.
abonie
approved these changes
Jun 8, 2026
auduchinok
approved these changes
Jun 11, 2026
… add PR link - Remove issue URL references from code comments and test methods (per auduchinok: redundant, commit links to PR with full context) - Add test for 'use' binding (non-unit after use) - Add test for computation expression after let binding - Add PR #19896 link to release notes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…0-let-binding-range
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dy covers the user-facing fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
auduchinok
reviewed
Jun 12, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous 'computation expression after let binding' test only used
async { return x } as a non-unit value - it didn't exercise CE-specific
syntax constructs. Replace with a while-loop test that genuinely exercises
the TcStmt lastExprRange fix in a different loop context.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…0-let-binding-range
abonie
approved these changes
Jun 23, 2026
This was referenced Jun 23, 2026
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.
Follow-up to #19504 addressing review feedback from @auduchinok.
#19504 fixed warning 20 ("expression is implicitly ignored") to point at the last expression of a sequential body inside
for/while. The walk only descended throughSynExpr.Sequential, so when the last expression was the body of alet/usebinding, the squiggle covered the wholeletexpression instead of just the offending tail:This PR also descends through
SynExpr.LetOrUse, so the squiggle lands onxalone in cases like the one above.It also corrects the issue reference cited by the original PR (#5418 — "Wrong expression is ignored warning range"; the previously cited #5735 is unrelated to this diagnostic).
Tracking: #5418