Unnamed repository; edit this file 'description' to name the repository.
fix: Do not merge spans if they have different anchors
Lukas Wirth 2024-12-29
parent dc6cea5 · commit 49b5093
-rw-r--r--crates/syntax-bridge/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/syntax-bridge/src/lib.rs b/crates/syntax-bridge/src/lib.rs
index 3a05b83e49..add6b1d5e0 100644
--- a/crates/syntax-bridge/src/lib.rs
+++ b/crates/syntax-bridge/src/lib.rs
@@ -1058,7 +1058,7 @@ where
// We don't do what rustc does exactly, rustc does something clever when the spans have different syntax contexts
// but this runs afoul of our separation between `span` and `hir-expand`.
SpanData {
- range: if a.ctx == b.ctx {
+ range: if a.ctx == b.ctx && a.anchor == b.anchor {
TextRange::new(
std::cmp::min(a.range.start(), b.range.start()),
std::cmp::max(a.range.end(), b.range.end()),