Skip to content

Commit 131fcf2

Browse files
committed
Fine-tune post-conditions.
The previous post-condition failed if a Ycheck was introduced between memoize and constructors.
1 parent af39d28 commit 131fcf2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/transform/Memoize.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ import Decorators._
4747
}
4848
tree match {
4949
case ddef: DefDef
50-
if !ddef.symbol.is(Deferred) && ddef.rhs == EmptyTree =>
50+
if !ddef.symbol.is(Deferred) &&
51+
!ddef.symbol.isConstructor && // constructors bodies are added later at phase Constructors
52+
ddef.rhs == EmptyTree =>
5153
errorLackImplementation(ddef)
5254
case tdef: TypeDef
5355
if tdef.symbol.isClass && !tdef.symbol.is(Deferred) && tdef.rhs == EmptyTree =>
@@ -89,10 +91,10 @@ import Decorators._
8991
}
9092

9193
lazy val field = sym.field.orElse(newField).asTerm
92-
94+
9395
def adaptToField(tree: Tree) =
9496
if (tree.isEmpty) tree else tree.ensureConforms(field.info.widen)
95-
97+
9698
if (sym.is(Accessor, butNot = NoFieldNeeded))
9799
if (sym.isGetter) {
98100
def skipBlocks(t: Tree): Tree = t match {

0 commit comments

Comments
 (0)