File tree 1 file changed +21
-0
lines changed
src/dotty/tools/dotc/transform 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,27 @@ import Decorators._
36
36
37
37
override def phaseName = " memoize"
38
38
39
+ /* Makes sure that, after getters and constructors gen, there doesn't
40
+ * exist non-deferred definitions that are not implemented. */
41
+ override def checkPostCondition (tree : Tree )(implicit ctx : Context ): Unit = {
42
+ def errorLackImplementation (t : Tree ) = {
43
+ val firstPhaseId = t.symbol.initial.validFor.firstPhaseId
44
+ val definingPhase = ctx.withPhase(firstPhaseId).phase.prev
45
+ throw new AssertionError (
46
+ i " Non-deferred definition introduced by $definingPhase lacks implementation: $t" )
47
+ }
48
+ tree match {
49
+ case ddef : DefDef
50
+ if ! ddef.symbol.is(Deferred ) && ddef.rhs == EmptyTree =>
51
+ errorLackImplementation(ddef)
52
+ case tdef : TypeDef
53
+ if tdef.symbol.isClass && ! tdef.symbol.is(Deferred ) && tdef.rhs == EmptyTree =>
54
+ errorLackImplementation(tdef)
55
+ case _ =>
56
+ }
57
+ super .checkPostCondition(tree)
58
+ }
59
+
39
60
/** Should run after mixin so that fields get generated in the
40
61
* class that contains the concrete getter rather than the trait
41
62
* that defines it.
You can’t perform that action at this time.
0 commit comments