Sitelet https://github.com/starkware-libs/cairo/commit/21290ceb84e7bba41a449f79a1b4b688fbe14084
Skip to content

Commit 21290ce

Browse files
committed
fix(semantic): use exclusive upper bound in ExpansionOffset::mapped
TextSpan.end is exclusive throughout the codebase, so an offset exactly at a mapping's span.end lies outside that mapping. Replace the inclusive `<= span.end` check with an exclusive range so a boundary offset resolves to the mapping that actually contains it (or to none), instead of matching the preceding adjacent mapping. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 75f957d commit 21290ce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crates/cairo-lang-semantic/src/expr/compute.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl ExpansionOffset {
126126
pub fn mapped(self, mappings: &[CodeMapping]) -> Option<Self> {
127127
let mapping = mappings
128128
.iter()
129-
.find(|mapping| mapping.span.start <= self.0 && self.0 <= mapping.span.end)?;
129+
.find(|mapping| (mapping.span.start..mapping.span.end).contains(&self.0))?;
130130
Some(Self::new(match mapping.origin {
131131
CodeOrigin::Start(offset) => offset.add_width(self.0 - mapping.span.start),
132132
CodeOrigin::Span(span) | CodeOrigin::CallSite(span) => span.start,

0 commit comments

Comments
 (0)