diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 24acce54cc4b..14ffa150818b 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -3635,6 +3635,9 @@ object Types { if ann.refersToParamOf(thisLambdaType) then TrueDeps else compute(status, parent, theAcc) case _: ThisType | _: BoundType | NoPrefix => status + case t: LazyRef => + if t.completed then compute(status, t.ref, theAcc) + else Unknown case _ => (if theAcc != null then theAcc else DepAcc()).foldOver(status, tp) compute(initial, tp, null) diff --git a/tests/pos/i14771.scala b/tests/pos/i14771.scala new file mode 100644 index 000000000000..31b12602fd00 --- /dev/null +++ b/tests/pos/i14771.scala @@ -0,0 +1,13 @@ +trait Layouts: + type Layout <: { + def withName(name: String): Layout + } + val l: Layout + +val ls = new Layouts: + class Layout17: + def withName(name: String): Layout17 = this + type Layout = Layout17 + val l = Layout17() + +def test = ls.l