File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import util.SourceFile
6
6
import ast .{tpd , untpd }
7
7
import dotty .tools .dotc .ast .tpd .{ Tree , TreeTraverser }
8
8
import dotty .tools .dotc .core .Contexts .Context
9
+ import dotty .tools .dotc .core .StdNames ._
9
10
import dotty .tools .dotc .core .SymDenotations .ClassDenotation
10
11
import dotty .tools .dotc .core .Symbols ._
11
12
@@ -35,13 +36,21 @@ object CompilationUnit {
35
36
assert(! unpickled.isEmpty, unpickled)
36
37
val unit1 = new CompilationUnit (new SourceFile (clsd.symbol.associatedFile, Seq ()))
37
38
unit1.tpdTree = unpickled
38
- if (forceTrees)
39
+ if (forceTrees) {
40
+ val force = new Force
39
41
force.traverse(unit1.tpdTree)
42
+ unit1.containsQuotesOrSplices = force.containsQuotes
43
+ }
40
44
unit1
41
45
}
42
46
43
47
/** Force the tree to be loaded */
44
- private object force extends TreeTraverser {
45
- def traverse (tree : Tree )(implicit ctx : Context ): Unit = traverseChildren(tree)
48
+ private class Force extends TreeTraverser {
49
+ var containsQuotes = false
50
+ def traverse (tree : Tree )(implicit ctx : Context ): Unit = {
51
+ if (tree.symbol.name.eq(nme.QUOTE ) && tree.symbol.owner.eq(defn.OpsPackageClass ))
52
+ containsQuotes = true
53
+ traverseChildren(tree)
54
+ }
46
55
}
47
56
}
Original file line number Diff line number Diff line change @@ -203,7 +203,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
203
203
// might be a type constructor.
204
204
Checking .checkInstantiable(tree.tpe, nu.pos)
205
205
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
207
209
super .transform(tree)
208
210
}
209
211
case tree : TypeApply =>
Original file line number Diff line number Diff line change
1
+ class Foo {
2
+ def foo : Unit = {
3
+ val expr = ' {
4
+ val a = 3
5
+ println(" foo" )
6
+ 2 + a
7
+ }
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments