Skip to content

Commit db47f14

Browse files
committed
Fix compiling quote in file with no splices
1 parent 4cd1122 commit db47f14

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-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 =>

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class FromTastyTests extends ParallelTesting {
4949
"t8023.scala",
5050
"tcpoly_ticket2096.scala",
5151
"t247.scala",
52+
"quote-no-splices.scala",
5253
)
5354
)
5455
step1.checkCompile() // Compile all files to generate the class files with tasty

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)