From 239bf45c71e26747df8989ac1aa62ab33249059f Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 21 Jan 2019 08:20:15 +0100 Subject: [PATCH] Fix #1342: Add postcondition assertion --- compiler/src/dotty/tools/dotc/transform/PostTyper.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index 091ed22b0365..cf9ca976b783 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -58,6 +58,12 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase /** the following two members override abstract members in Transform */ override def phaseName: String = PostTyper.name + override def checkPostCondition(tree: tpd.Tree)(implicit ctx: Context): Unit = tree match { + case tree: ValOrDefDef => + assert(!tree.symbol.signature.isUnderDefined) + case _ => + } + override def changesMembers: Boolean = true // the phase adds super accessors and synthetic methods override def transformPhase(implicit ctx: Context): Phase = thisPhase.next