Skip to content

Commit 27e620f

Browse files
committed
Fix compiling quote in file with no splices
1 parent 39e466d commit 27e620f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
203203
// might be a type constructor.
204204
Checking.checkInstantiable(tree.tpe, nu.pos)
205205
withNoCheckNews(nu :: Nil)(super.transform(tree))
206-
case _ =>
206+
case meth =>
207+
if (meth.symbol.name.eq(nme.QUOTE) && meth.symbol.owner.eq(defn.OpsPackageClass))
208+
ctx.compilationUnit.containsQuotesOrSplices = true
207209
super.transform(tree)
208210
}
209211
case tree: TypeApply =>

tests/pos/quote-no-splices.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Foo {
2+
def foo: Unit = {
3+
val expr ='{
4+
val a = 3
5+
println("foo")
6+
2 + a
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)