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 @@ -317,9 +317,14 @@ class ExtractSemanticDB extends Phase:
317
317
registerSymbol(sym, symkinds)
318
318
319
319
private def namePresentInSource (sym : Symbol , span : Span , source: SourceFile )(using Context ): Boolean =
320
- val content = source.content()
321
- val (start, end) = if content(span.end - 1 ) == '`' then (span.start + 1 , span.end - 1 ) else (span.start, span.end)
322
- content.slice(start, end).mkString == sym.name.stripModuleClassSuffix.lastPart.toString
320
+ if ! span.exists then false
321
+ else
322
+ val content = source.content()
323
+ val (start, end) =
324
+ if content.lift(span.end - 1 ).map(_ == '`' ).getOrElse(false ) then
325
+ (span.start + 1 , span.end - 1 )
326
+ else (span.start, span.end)
327
+ content.slice(start, end).mkString == sym.name.stripModuleClassSuffix.lastPart.toString
323
328
324
329
private def spanOfSymbol (sym : Symbol , span : Span , treeSource : SourceFile )(using Context ): Span =
325
330
val contents = if treeSource.exists then treeSource.content() else Array .empty[Char ]
You can’t perform that action at this time.
0 commit comments