Skip to content

Bugfix :: Sequence points #19278

Open
T-Gro wants to merge 22 commits intomainfrom
bugfix/sequence-points
Open

Bugfix :: Sequence points #19278
T-Gro wants to merge 22 commits intomainfrom
bugfix/sequence-points

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Feb 12, 2026

Debug point / sequence point fixes

  • Fixes Extra sequence point at the end of match expressions #12052 — Extra sequence point at end of match expressions caused debugger to briefly stop at unrelated branches during Step Over. Fixed by always emitting hidden code at decision tree join points in IlxGen.fs, not only when the stack is non-empty. Also covers the if/elif/else case mentioned in the comments. Tests: MatchEndSequencePoint.fs (5 tests including if/then/else).

  • Fixes Wrong sequence point range for return inside async computation expression #19248return, yield, return!, yield! in CEs had debug points covering only the keyword range instead of the full expression (e.g. return instead of return 1). Fixed by using the full expression range (mFull) for DebugPointAtLeafExpr in CheckComputationExpressions.fs. Tests: CEDebugPoints.fs (6 tests covering return, yield, return!, yield! in async/task/custom CEs).

  • Fixes Extra out-of-order sequence point for use in task computation expressions #19255use bindings in task CEs emitted an extra out-of-order sequence point (nop at the use line before let on the prior line), making execution appear to jump backwards. Fixed by using mBind instead of leadingKeyword.Range for the Using call and switching DebugPointAtTarget to No. Tests: CEDebugPoints.fs (Use in task CE test).

  • Fixes Debug points failing to bind in body of "[ for x in xs -> body ]" #13504 — Debug points failed to bind in [ for x in xs -> body ] arrow comprehensions. The SeqMap pattern in LowerComputedCollections.fs was stripping debug points from the loop body during lowering. Fixed by preserving them via DebugPoints active pattern. Tests: ForArrowDebugPoints.fs (3 tests: list, array, and for-do-yield contrast).

T-Gro added 6 commits February 8, 2026 16:39
Breakpoints inside 'for x in xs -> body' (arrow syntax in list/array/seq
comprehensions) failed to bind because the SeqMap active pattern in
LowerComputedCollections.fs did not preserve debug point wrappers.

Fix: wrap body extraction in DebugPoints and return 'debug body', matching
the existing SeqCollectSingle pattern.

Add 3 tests verifying debug points exist on body expressions for list arrow,
array arrow, and do-yield comprehension forms.
  range (e.g., 'return 1' not just 'return') by using mFull instead of
  keyword-only range m in DebugPointAtLeafExpr.Yes

- Fix use binding in CE to use DebugPointAtTarget.No on the SynMatchClause
  to avoid generating an extra sequence point from the match target

- Add VerifyMethodSequencePoints test infrastructure to verify sequence
  points for specific methods (e.g., Invoke, MoveNext, GenerateNext)

- Add CEDebugPoints test module with 3 tests validating the fixes
- Fix compiler: use full binding range (mBind) instead of keyword-only range
  (leadingKeyword.Range) in mkSynCall for 'use' CE translation, eliminating
  the use-keyword-only sequence point in state machine output.
- Extract verifyCEMethodDebugPoints helper to reduce test boilerplate.
- Change use test from async/Invoke to task/MoveNext for single-method SP
  validation in the state machine.
- Update expected SP values to match actual compiler output.
- All 3 CEDebugPoints tests pass; PortablePdbs, ForArrowDebugPoints, and
  AsyncExpressionStepping regression tests pass.
@T-Gro T-Gro marked this pull request as ready for review February 12, 2026 17:01
@T-Gro T-Gro requested a review from a team as a code owner February 12, 2026 17:01
@T-Gro T-Gro changed the title WIP :: Bugfix :: Sequence points Bugfix :: Sequence points Feb 12, 2026
@T-Gro T-Gro requested a review from abonie February 12, 2026 17:03
@T-Gro T-Gro force-pushed the bugfix/sequence-points branch from 38c2f6e to 1ce8e10 Compare February 12, 2026 22:43
T-Gro and others added 6 commits February 13, 2026 00:03
…oc, and echo comments

Addresses NO-LEFTOVERS verifier feedback:
- Remove banner-style section separators in test helpers
- Remove xmldoc that restates function names
- Remove comments echoing code below them in test assertions
- Condense verbose implementation xmldoc to issue URLs
- Fix tryFixupSpan -> FixedSpan reference in ClassificationService.fs
- Fix duplicate URL in FindReferences.fs #line directive test
The function is only called internally within NameResolution.fs, so it
should not be exposed in the .fsi file. This minimizes the module's
public API surface as flagged by CODE-QUALITY verifier.
@github-actions
Copy link
Contributor

🔧 CLI Command Report

  • Command: /run fantomas
  • Outcome: success

✅ Patch applied:
- Files changed: 1
- Lines changed: 14

@auduchinok
Copy link
Member

auduchinok commented Feb 13, 2026

@T-Gro Thanks for working on it!

I usually try to go through the PRs in this repo and to leave a comment if something doesn't look correct. With these recent big PRs I find it very difficult to review them when multiple unrelated changes get mixed. Could you consider working on mutually independent fixes in separate PRs in the future? I'm afraid otherwise there would much less chance that someone else reviews them carefully enough to spot an issue.

In addition to the possible creeping in bugs it makes it almost impossible to learn the codebase from these PRs. With independent PRs you can easily see what changes were needed for a fix and where and then try learn from it. With tens of fixes mixed up, like in #19279, the time needed to even isolate the changes is just not worth it, which is really sad.

@T-Gro
Copy link
Member Author

T-Gro commented Feb 13, 2026

@auduchinok : Thanks for keeping an eye on the changes, point taken.

I want to leverage coupling potential as there sometimes is a hiding shared cause for multiple issues, or at least some overlapping concerns.
My assumption was that a review for correlated bugfixes from the same narrow area (like this one) is easier to asses than the sum of individuals - but maybe I was wrong.

Please ignore the "WIP .." one - indeed there is not much correlation, it's more on the experimental side. Based on your point, even if/when I get that one to success, there it will be appropriate to split it prior to marking it "Ready for review".

What is your view on this one in particular?
Because I knew I needed some new test infrastructure, baselines changed and overall touch the same files for the same purpose.

@T-Gro
Copy link
Member Author

T-Gro commented Feb 13, 2026

/run ilverify

@dotnet dotnet deleted a comment from github-actions bot Feb 13, 2026
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 13, 2026
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 13, 2026
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 13, 2026
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 13, 2026
@dotnet dotnet deleted a comment from github-actions bot Feb 13, 2026
@github-actions
Copy link
Contributor

🔧 CLI Command Report

  • Command: /run ilverify
  • Outcome: success

✅ Command succeeded, no changes needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

3 participants