Skip to content

Keep a stale hint from reaching into the next member - #785

Merged
SimonCropp merged 4 commits into
mainfrom
fix-patcher-hint-escapes-member
Aug 22, 2026
Merged

Keep a stale hint from reaching into the next member#785
SimonCropp merged 4 commits into
mainfrom
fix-patcher-hint-escapes-member

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

The recorded line is tried before anything else, so that two snapshots in one
member stay apart. But it was tried whenever it sat at or below the member's
declaration, with nothing above it - and a member's declaration bounds the
search from below only, so "below" reaches to the end of the file.

That makes the hint outrank the member name in exactly the case the member name
exists for. A hint goes stale as soon as anything above it is edited, and a
stale one pointing into the test next door rewrote that test's identical
snapshot and left this one as it was, reporting Applied.

Only take the hint when no declaration sits between the member's own and it,
which is the cheap half of asking whether the hint is still inside the member.
When no member was named there is nothing to be outside of, and the hint is all
there is - so that path is untouched.

The recorded line is tried before anything else, so that two snapshots in one
member stay apart. But it was tried whenever it sat at or below the member's
declaration, with nothing above it - and a member's declaration bounds the
search from below only, so "below" reaches to the end of the file.

That makes the hint outrank the member name in exactly the case the member name
exists for. A hint goes stale as soon as anything above it is edited, and a
stale one pointing into the test next door rewrote that test's identical
snapshot and left this one as it was, reporting Applied.

Only take the hint when no declaration sits between the member's own and it,
which is the cheap half of asking whether the hint is still inside the member.
When no member was named there is nothing to be outside of, and the hint is all
there is - so that path is untouched.
…pes-member

# Conflicts:
#	src/DiffEngine.Tests/InlinePatcherTests.cs
…pes-member

# Conflicts:
#	src/DiffEngine.Tests/InlinePatcherTests.cs
@SimonCropp
SimonCropp merged commit 44afc67 into main Aug 22, 2026
8 checks passed
@SimonCropp
SimonCropp deleted the fix-patcher-hint-escapes-member branch August 22, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant