Refactor SpanPair to preserve zero-length location semantics#45
Merged
Conversation
Copilot created this pull request from a session on behalf of
ehwan
June 15, 2026 11:24
View session
Copilot
AI
changed the title
Centralize byte-range→Span fallback through one global function
Refactor SpanPair to preserve zero-length location semantics
Jun 15, 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.
Please run
scripts/bootstrap_test.shand push all of the changes it make before making the PR.This will run brief tests, and make it easier to look at what part of generated code has been changed.
SpanPairpreviously usedOption<(usize, usize)>, which collapsed zero-length and missing-context cases. This change makes zero-length spans explicit as(pos, pos)so identical length can still carry distinct source positions.Span storage model
SpanPair.pairfromOption<(usize, usize)>to(usize, usize).Zero-length position semantics
len == 0, location now resolves to the end position of the most recent token as(e, e).Fallback behavior
(0, 0).Spanconversion remains centralized viabyte_range_to_span.