File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,17 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
32
32
override def phaseName : String = " constructors"
33
33
override def runsAfter : Set [Class [_ <: Phase ]] = Set (classOf [Erasure ])
34
34
35
+
36
+ /** All initializers should be moved into constructor
37
+ */
38
+ override def checkPostCondition (tree : tpd.Tree )(implicit ctx : Context ): Unit = {
39
+ 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 _ =>
43
+ }
44
+ }
45
+
35
46
/** Symbols that are owned by either <local dummy> or a class field move into the
36
47
* primary constructor.
37
48
*/
You can’t perform that action at this time.
0 commit comments