Skip to content

Commit

Permalink
Fix #19808: Don't force to compute the owner of a symbol when there i…
Browse files Browse the repository at this point in the history
…s no denotation (#19813)

Fix #19808: Don't force to compute the owner of a symbol when there is
no denotation.
  • Loading branch information
noti0na1 authored Feb 28, 2024
2 parents 8bcd9a9 + 784abfb commit f24960c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Nullables.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/explicit-nulls/pos/i19808.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import scala.reflect.Selectable.reflectiveSelectable

def saveRedir(what: {def validate: List[String]}) =
what.validate match
case Nil => ???
case xs => ???
6 changes: 6 additions & 0 deletions tests/pos/i19808.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import scala.reflect.Selectable.reflectiveSelectable

def saveRedir(what: {def validate: List[String]}) =
what.validate match
case Nil => ???
case xs => ???

0 comments on commit f24960c

Please sign in to comment.