Skip to content

Commit fae2b09

Browse files
committed
Add some post conditions to ReifyQuotes
1 parent 82f954e commit fae2b09

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ class ReifyQuotes extends MacroTransformWithImplicits {
7474

7575
override def phaseName: String = "reifyQuotes"
7676

77+
override def checkPostCondition(tree: tpd.Tree)(implicit ctx: Context): Unit = {
78+
if (ctx.owner.ownersIterator.exists(_.isTransparentMethod)) {
79+
tree match {
80+
case tree: Select if tree.symbol == defn.QuotedExpr_~ =>
81+
assert(Splicer.canBeSpliced(tree.qualifier))
82+
case _ =>
83+
}
84+
} else {
85+
assert(tree.symbol != defn.QuotedExpr_~)
86+
// assert(tree.symbol != defn.QuotedType_~) // TODO widen ~ type references at stage 0?
87+
assert(tree.symbol != defn.QuotedExpr_apply)
88+
assert(tree.symbol != defn.QuotedType_apply)
89+
}
90+
}
91+
7792
override def run(implicit ctx: Context): Unit =
7893
if (ctx.compilationUnit.containsQuotesOrSplices) super.run
7994

0 commit comments

Comments
 (0)