Skip to content

Commit 9f70200

Browse files
authored
bugfix: Make sure that we can query tree.source (#24123)
Related to scalameta/metals#7802
2 parents f2acd0c + b8062e1 commit 9f70200

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ object InteractiveEnrichments extends CommonMtagsEnrichments:
313313
case Select(_, name: TermName) if infixNames(name) => false
314314
case Select(This(_), _) => false
315315
// is a select statement without a dot `qual.name`
316-
case sel @ Select(qual, _) if !sel.symbol.is(Synthetic) =>
316+
case sel @ Select(qual, _) if !sel.symbol.is(Synthetic) && sel.nameSpan.start < tree.source.length =>
317317
val source = tree.source
318318
!(qual.span.end until sel.nameSpan.start)
319319
.map(source.apply)

0 commit comments

Comments
 (0)