Skip to content

Commit f24960c

Browse files
authored
Fix #19808: Don't force to compute the owner of a symbol when there is no denotation (#19813)
Fix #19808: Don't force to compute the owner of a symbol when there is no denotation.
2 parents 8bcd9a9 + 784abfb commit f24960c

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Nullables.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ object Nullables:
283283
*/
284284
def usedOutOfOrder(using Context): Boolean =
285285
val refSym = ref.symbol
286-
val refOwner = refSym.owner
286+
val refOwner = refSym.maybeOwner
287287

288288
@tailrec def recur(s: Symbol): Boolean =
289289
s != NoSymbol

tests/explicit-nulls/pos/i19808.scala

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.reflect.Selectable.reflectiveSelectable
2+
3+
def saveRedir(what: {def validate: List[String]}) =
4+
what.validate match
5+
case Nil => ???
6+
case xs => ???

tests/pos/i19808.scala

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.reflect.Selectable.reflectiveSelectable
2+
3+
def saveRedir(what: {def validate: List[String]}) =
4+
what.validate match
5+
case Nil => ???
6+
case xs => ???

0 commit comments

Comments
 (0)