Skip to content

Commit bdf09d6

Browse files
Backport "Fix #19808: Don't force to compute the owner of a symbol when there is no denotation" to LTS (#20962)
Backports #19813 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents cc12fbb + da4d732 commit bdf09d6

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ object Nullables:
262262
*/
263263
def usedOutOfOrder(using Context): Boolean =
264264
val refSym = ref.symbol
265-
val refOwner = refSym.owner
265+
val refOwner = refSym.maybeOwner
266266

267267
@tailrec def recur(s: Symbol): Boolean =
268268
s != NoSymbol

tests/explicit-nulls/pos/i19808.scala

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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)