diff --git a/compiler/src/dotty/tools/dotc/util/SourcePosition.scala b/compiler/src/dotty/tools/dotc/util/SourcePosition.scala index 5290652a384f..7808c9a57acd 100644 --- a/compiler/src/dotty/tools/dotc/util/SourcePosition.scala +++ b/compiler/src/dotty/tools/dotc/util/SourcePosition.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package util -import scala.language.{unsafeNulls => _} - import printing.{Showable, Printer} import printing.Texts._ import core.Contexts.Context @@ -67,7 +65,7 @@ extends SrcPos, interfaces.SourcePosition, Showable { def toSynthetic: SourcePosition = withSpan(span.toSynthetic) def outermost: SourcePosition = - if outer == NoSourcePosition then this else outer.outermost + if outer == null || outer == NoSourcePosition then this else outer.outermost /** Inner most position that is contained within the `outermost` position. * Most precise position that comes from the call site. @@ -87,7 +85,7 @@ extends SrcPos, interfaces.SourcePosition, Showable { } /** A sentinel for a non-existing source position */ -@sharable object NoSourcePosition extends SourcePosition(NoSource, NoSpan) { +@sharable object NoSourcePosition extends SourcePosition(NoSource, NoSpan, null) { override def line: Int = -1 override def column: Int = -1 override def toString: String = "?"