diff --git a/compiler/src/dotty/tools/dotc/typer/Nullables.scala b/compiler/src/dotty/tools/dotc/typer/Nullables.scala index cc3fac3a6ffd..914fc0acb89d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Nullables.scala +++ b/compiler/src/dotty/tools/dotc/typer/Nullables.scala @@ -283,7 +283,7 @@ object Nullables: */ def usedOutOfOrder(using Context): Boolean = val refSym = ref.symbol - val refOwner = refSym.owner + val refOwner = refSym.maybeOwner @tailrec def recur(s: Symbol): Boolean = s != NoSymbol diff --git a/tests/explicit-nulls/pos/i19808.scala b/tests/explicit-nulls/pos/i19808.scala new file mode 100644 index 000000000000..57937ecabb03 --- /dev/null +++ b/tests/explicit-nulls/pos/i19808.scala @@ -0,0 +1,6 @@ +import scala.reflect.Selectable.reflectiveSelectable + +def saveRedir(what: {def validate: List[String]}) = + what.validate match + case Nil => ??? + case xs => ??? diff --git a/tests/pos/i19808.scala b/tests/pos/i19808.scala new file mode 100644 index 000000000000..57937ecabb03 --- /dev/null +++ b/tests/pos/i19808.scala @@ -0,0 +1,6 @@ +import scala.reflect.Selectable.reflectiveSelectable + +def saveRedir(what: {def validate: List[String]}) = + what.validate match + case Nil => ??? + case xs => ???