Skip to content

Fix lost source range for empty-bodied computation expressions in pipelines (#19550) - #19849

Merged
T-Gro merged 8 commits into
mainfrom
fix/issue-19550
Jun 23, 2026
Merged

Fix lost source range for empty-bodied computation expressions in pipelines (#19550)#19849
T-Gro merged 8 commits into
mainfrom
fix/issue-19550

Conversation

@T-Gro

Copy link
Copy Markdown
Member

Summary

Fixes#19550

When a computation expression with an empty body (e.g. foo {}) is used in a pipeline, the synthesized Zero() call was given range0 (i.e. unknown(1,1)) instead of the actual source location. This caused type mismatch errors to report nonsensical locations and LSP diagnostics to be lost.

Changes

  • CheckExpressions.fs: Pass mExprAndArg (the full App range) instead of mLeftExpr as the mWhole parameter to TcComputationExpression, so the synthesized Zero() call receives a meaningful range when the CE body is empty.
  • CheckComputationExpressions.fs: In the SynExpr.ImplicitZero translation, fall back to ceenv.mWhole when the incoming range is range0, defensively preventing zero-ranged synthesized calls from reaching codegen/diagnostics.
  • SemanticClassification.fs / ConstraintSolver.fs: Minor cleanup in the same area.

Tests

Added tests/FSharp.Compiler.ComponentTests/Language/CE_PipelineRange19550.fs with comprehensive tests covering:

  • Empty CE in forward pipe, backward pipe, composition, and direct application
  • Nested pipelines and multi-step pipelines
  • Verification that error ranges point to the correct source location

Release Notes

Added entry in docs/release-notes/.FSharp.Compiler.Service/11.0.100.md.

Copilotand others added 2 commits May 28, 2026 15:53
…elines (#19550)
- Pass mExprAndArg (full App range) instead of mLeftExpr as mWhole to TcComputationExpression so that the synthesized Zero() call has a meaningful range when the CE body is empty.
- Fall back to ceenv.mWhole inside the SynExpr.ImplicitZero translation when the incoming range is range0, defensively preventing zero-ranged synthesized calls from reaching codegen / diagnostics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the CE_PipelineRange19550 test file (registered in the ComponentTests fsproj) and a release-notes bullet in 11.0.100.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actionsBot commented May 28, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ Found changes and release notes in following paths:

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/11.0.100.md

@github-actionsgithub-actionsBot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label May 28, 2026
@T-Gro
T-Gro requested a review from abonieJune 2, 2026 10:37
@T-Gro
T-Gro enabled auto-merge (squash) June 2, 2026 10:37
Copilotand others added 3 commits June 2, 2026 13:45
…50 tests
The test names are self-documenting. Removed 151 lines of noise:
- Massive module-level doc comment explaining sprint plans
- // ---- block separator lines between every test
- Per-test essays about current/expected behavior
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actionsgithub-actionsBot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Jun 3, 2026
@github-project-automationgithub-project-automationBot moved this from New to In Progress in F# Compiler and ToolingJun 11, 2026
@T-Gro
T-Gro requested a review from abonieJune 23, 2026 13:00
@T-Gro
T-Gro merged commit 2714128 into mainJun 23, 2026
50 checks passed
@github-project-automationgithub-project-automationBot moved this from In Progress to Done in F# Compiler and ToolingJun 23, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-BypassedTooling check: non-fork PR, not diff-analyzedAI-Tooling-Check-Scanned-CleanTooling check: diff analyzed, no interesting infrastructure files

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Source location gets lost when a type mismatch happens on computation expression

4 participants

@T-Gro@auduchinok@brianrourkeboll@abonie