diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala index ded1a950be50..c435144a5b77 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala @@ -74,6 +74,18 @@ class ReifyQuotes extends MacroTransformWithImplicits { override def phaseName: String = "reifyQuotes" + override def checkPostCondition(tree: Tree)(implicit ctx: Context): Unit = { + tree match { + case tree: RefTree if !ctx.inTransparentMethod => + assert(!tree.symbol.isQuote) + // assert(!tree.symbol.isSplice) // TODO widen ~ type references at stage 0? + assert(tree.symbol != defn.QuotedExpr_~) + case tree: Select if tree.symbol == defn.QuotedExpr_~ => + assert(Splicer.canBeSpliced(tree.qualifier)) + case _ => + } + } + override def run(implicit ctx: Context): Unit = if (ctx.compilationUnit.containsQuotesOrSplices) super.run