File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,19 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
30
30
import tpd ._
31
31
32
32
override def phaseName : String = " constructors"
33
- override def runsAfter : Set [Class [_ <: Phase ]] = Set (classOf [Erasure ])
33
+ override def runsAfter : Set [Class [_ <: Phase ]] = Set (classOf [Memoize ])
34
34
35
35
36
- /** All initializers should be moved into constructor
37
- */
36
+ /** All initializers for non-lazy fields should be moved into constructor.
37
+ * All non-abstract methods should be implemented (this is assured for constructors
38
+ * in this phase and for other methods in memoize).
39
+ */
38
40
override def checkPostCondition (tree : tpd.Tree )(implicit ctx : Context ): Unit = {
39
41
tree match {
40
- case t : ValDef if ((t.rhs ne EmptyTree ) && ! (t.symbol is Flags .Lazy ) && t.symbol.owner.isClass) =>
41
- assert(false , i " $t initializers should be moved to constructors " )
42
+ case tree : ValDef if tree.symbol.exists && tree.symbol.owner.isClass && ! tree.symbol.is(Lazy ) =>
43
+ assert(tree.rhs.isEmpty, i " $tree: initializer should be moved to constructors " )
44
+ case tree : DefDef if ! tree.symbol.is(LazyOrDeferred ) =>
45
+ assert(! tree.rhs.isEmpty, i " unimplemented: $tree" )
42
46
case _ =>
43
47
}
44
48
}
Original file line number Diff line number Diff line change @@ -42,12 +42,6 @@ import Decorators._
42
42
*/
43
43
override def runsAfter : Set [Class [_ <: Phase ]] = Set (classOf [Mixin ])
44
44
45
- override def checkPostCondition (tree : Tree )(implicit ctx : Context ): Unit = tree match {
46
- case tree : DefDef if ! tree.symbol.is(Lazy | Deferred ) =>
47
- assert(! tree.rhs.isEmpty, i " unimplemented: $tree" )
48
- case _ =>
49
- }
50
-
51
45
override def transformDefDef (tree : DefDef )(implicit ctx : Context , info : TransformerInfo ): Tree = {
52
46
val sym = tree.symbol
53
47
You can’t perform that action at this time.
0 commit comments