Skip to content

Add computation-expression tests for warning 20 range - #19992

Merged
T-Gro merged 2 commits into
mainfrom
copilot/fix-warning-20-let-binding-range
Jul 1, 2026
Merged

Add computation-expression tests for warning 20 range#19992
T-Gro merged 2 commits into
mainfrom
copilot/fix-warning-20-let-binding-range

Conversation

@T-Gro

Copy link
Copy Markdown
Member

Test-only follow-up to #19896, adding the computation-expression coverage requested in review.

Inside a CE the loop body is desugared per-statement, so the trailing expression reaches TcStmt on its own and warning 20 highlights only the offending expression. async/task warn on the value alone; seq treats it as an implicit yield, so it doesn't warn at all.

…19896)
Answers @auduchinok's open question on PR #19896: in a computation
expression the loop body is desugared per-statement, so the trailing
expression reaches TcStmt on its own and warning 20 highlights only the
offending expression (e.g. 'x'), same as the non-CE case.
- async CE: asserts the squiggle lands on 'x' alone (Line 6, Col 13-14).
- seq CE: trailing non-unit value is an implicit yield, so no warning 20.
The CE test originally requested in review was removed in 0127569; this
reinstates a genuine CE case plus the seq implicit-yield contrast.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actionsBot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@github-actionsgithub-actionsBot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Jun 24, 2026
@T-GroT-Gro added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Jun 25, 2026
@T-Gro
T-Gro requested a review from abonieJune 25, 2026 13:53
@T-Gro
T-Gro enabled auto-merge (squash) June 25, 2026 13:53

@T-GroT-Gro left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by AI (@expert-reviewer agent). Findings may contain inaccuracies — please verify independently.

Test-only PR adding two computation-expression cases for the warning 20 range fix (#19896). Reviewed for correctness:

  • The async test asserts the warning highlights only the trailing offending expression (Line 6, Col 13-14), matching the per-statement desugaring of CE loop bodies through TcStmt.
  • The seq test uses typecheck |> shouldSucceed. This is a meaningful assertion (not a no-op): the test harness treats warnings as failures by default (IgnoreWarnings = false, Compiler.fs ~L1046), so shouldSucceed genuinely guarantees no warning 20 is emitted for the implicit-yield case.

No production code is touched; no correctness, security, or performance concerns. Optional: the description mentions task behaving like async, but only async is covered — a task case would round out the matrix, though it is not required.

@T-GroT-Gro added the AI-reviewed PR reviewed by AI review council label Jun 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-reviewedPR reviewed by AI review councilAI-Tooling-Check-BypassedTooling check: non-fork PR, not diff-analyzedNO_RELEASE_NOTESLabel for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants

@T-Gro@abonie