Skip to content

Commit b3e006f

Browse files
committed
Don't force LazyRefs when computing DepStatus
Fixes #14771
1 parent fdd43d7 commit b3e006f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,9 @@ object Types {
36353635
if ann.refersToParamOf(thisLambdaType) then TrueDeps
36363636
else compute(status, parent, theAcc)
36373637
case _: ThisType | _: BoundType | NoPrefix => status
3638+
case t: LazyRef =>
3639+
if t.completed then compute(status, t.ref, theAcc)
3640+
else Unknown
36383641
case _ =>
36393642
(if theAcc != null then theAcc else DepAcc()).foldOver(status, tp)
36403643
compute(initial, tp, null)

tests/pos/i14771.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait Layouts:
2+
type Layout <: {
3+
def withName(name: String): Layout
4+
}
5+
val l: Layout
6+
7+
val ls = new Layouts:
8+
class Layout17:
9+
def withName(name: String): Layout17 = this
10+
type Layout = Layout17
11+
val l = Layout17()
12+
13+
def test = ls.l

0 commit comments

Comments
 (0)