Skip to content

Commit 0949d5e

Browse files
committed
Give DerivedFromParamTree#ensureCompletions an example
1 parent 7bdeb0b commit 0949d5e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ object desugar {
9393
def completeConstructor(sym: Symbol) =
9494
sym.infoOrCompleter match {
9595
case completer: Namer#ClassCompleter =>
96+
// An example, derived from tests/run/t6385.scala
97+
//
98+
// class Test():
99+
// def t1: Foo = Foo(1)
100+
// final case class Foo(value: Int)
101+
//
102+
// Here's the sequence of events:
103+
// * The symbol for Foo.apply is forced to complete
104+
// * The symbol for the `value` parameter of the apply method is forced to complete
105+
// * Completing that value parameter requires typing its type, which is a DerivedTypeTrees,
106+
// which only types if it has an OriginalSymbol.
107+
// * So if the case class hasn't been completed, we need (at least) its constructor to be completed
96108
completer.completeConstructor(sym)
97109
case _ =>
98110
}

0 commit comments

Comments
 (0)