Skip to content

Commit 610ad9c

Browse files
committed
Fix compiling quote in file with no splices
1 parent 88b7f46 commit 610ad9c

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

compiler/src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dotty.tools.dotc.ast.tpd.{ Tree, TreeTraverser }
88
import dotty.tools.dotc.core.Contexts.Context
99
import dotty.tools.dotc.core.SymDenotations.ClassDenotation
1010
import dotty.tools.dotc.core.Symbols._
11+
import dotty.tools.dotc.transform.SymUtils._
1112

1213
class CompilationUnit(val source: SourceFile) {
1314

@@ -39,13 +40,21 @@ object CompilationUnit {
3940
assert(!unpickled.isEmpty, unpickled)
4041
val unit1 = new CompilationUnit(source)
4142
unit1.tpdTree = unpickled
42-
if (forceTrees)
43+
if (forceTrees) {
44+
val force = new Force
4345
force.traverse(unit1.tpdTree)
46+
unit1.containsQuotesOrSplices = force.containsQuotes
47+
}
4448
unit1
4549
}
4650

4751
/** Force the tree to be loaded */
48-
private object force extends TreeTraverser {
49-
def traverse(tree: Tree)(implicit ctx: Context): Unit = traverseChildren(tree)
52+
private class Force extends TreeTraverser {
53+
var containsQuotes = false
54+
def traverse(tree: Tree)(implicit ctx: Context): Unit = {
55+
if (tree.symbol.isQuote)
56+
containsQuotes = true
57+
traverseChildren(tree)
58+
}
5059
}
5160
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
180180
override def transform(tree: Tree)(implicit ctx: Context): Tree =
181181
try tree match {
182182
case tree: Ident if !tree.isType =>
183+
handleMeta(tree.symbol)
183184
tree.tpe match {
184185
case tpe: ThisType => This(tpe.cls).withPos(tree.pos)
185186
case _ => tree
@@ -203,9 +204,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
203204
// might be a type constructor.
204205
Checking.checkInstantiable(tree.tpe, nu.pos)
205206
withNoCheckNews(nu :: Nil)(super.transform(tree))
206-
case meth =>
207-
if (meth.symbol.isQuote)
208-
ctx.compilationUnit.containsQuotesOrSplices = true
207+
case _ =>
209208
super.transform(tree)
210209
}
211210
case tree: TypeApply =>

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ class FromTastyTests extends ParallelTesting {
3737
"i3000.scala",
3838
"i536.scala",
3939
"i974.scala",
40-
"quote-liftable.scala",
41-
"quote-0.scala",
42-
"quote-1.scala",
43-
"quote-stagedInterpreter.scala",
4440
"t1203a.scala",
4541
"t2260.scala",
4642
"t3612.scala", // Test never finishes
@@ -49,7 +45,6 @@ class FromTastyTests extends ParallelTesting {
4945
"t8023.scala",
5046
"tcpoly_ticket2096.scala",
5147
"t247.scala",
52-
"quote-no-splices.scala",
5348
)
5449
)
5550
step1.checkCompile() // Compile all files to generate the class files with tasty

0 commit comments

Comments
 (0)