File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
compiler/src/dotty/tools/dotc/semanticdb Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -540,9 +540,14 @@ class ExtractSemanticDB extends Phase:
540
540
registerSymbol(sym, symbol, symkinds)
541
541
542
542
private def namePresentInSource (sym : Symbol , span : Span , source: SourceFile )(using Context ): Boolean =
543
- val content = source.content()
544
- val (start, end) = if content(span.end - 1 ) == '`' then (span.start + 1 , span.end - 1 ) else (span.start, span.end)
545
- content.slice(start, end).mkString == sym.name.stripModuleClassSuffix.lastPart.toString
543
+ if ! span.exists then false
544
+ else
545
+ val content = source.content()
546
+ val (start, end) =
547
+ if content.lift(span.end - 1 ).exists(_ == '`' ) then
548
+ (span.start + 1 , span.end - 1 )
549
+ else (span.start, span.end)
550
+ content.slice(start, end).mkString == sym.name.stripModuleClassSuffix.lastPart.toString
546
551
547
552
private def spanOfSymbol (sym : Symbol , span : Span , treeSource : SourceFile )(using Context ): Span =
548
553
val contents = if treeSource.exists then treeSource.content() else Array .empty[Char ]
You can’t perform that action at this time.
0 commit comments