File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/tastyreflect
tests/pos-macros/treemap-unapply Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
110110
111111 def matchStatement (tree : Tree )(given Context ): Option [Statement ] = tree match {
112112 case _ : PatternTree => None
113- case tree if tree.isTerm => Some (tree)
113+ case tree if tree.isTerm => matchTerm (tree)
114114 case _ => matchDefinition(tree)
115115 }
116116
@@ -226,6 +226,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
226226 type Term = tpd.Tree
227227
228228 def matchTerm (tree : Tree )(given Context ): Option [Term ] = tree match {
229+ case _ if matchTree_Unapply(tree).isDefined => None
229230 case _ : PatternTree => None
230231 case x : tpd.SeqLiteral => Some (tree)
231232 case _ if tree.isTerm => Some (tree)
Original file line number Diff line number Diff line change 1+ import scala .quoted .{ given , _ }
2+
3+ inline def mcr (x : => Unit ): Unit = $ {mcrImpl(' x )}
4+ def mcrImpl (x : Expr [Unit ])(given ctx : QuoteContext ): Expr [Unit ] =
5+ import ctx .tasty .{ given , _ }
6+ val tr : Term = x.unseal
7+ object m extends TreeMap
8+ m.transformTerm(tr).seal.cast[Unit ]
Original file line number Diff line number Diff line change 1+ @ main def Test = mcr {
2+ val (a, b) = ???
3+ println(s " Foo bar " )
4+ }
You can’t perform that action at this time.
0 commit comments