File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -76,18 +76,24 @@ abstract class TreeMapWithStages(@constructorOnly ictx: Context) extends TreeMap
76
76
enteredSyms = enteredSyms.tail
77
77
}
78
78
79
+ def dropEmptyBlocks (tree : Tree ): Tree = tree match {
80
+ case Block (Nil , expr) => dropEmptyBlocks(expr)
81
+ case _ => tree
82
+ }
83
+
79
84
tree match {
80
- case Quoted (Spliced (t)) =>
81
- transform(t) // '(~x) --> x
82
85
83
86
case Quoted (quotedTree) =>
84
- transformQuotation (quotedTree, tree)
85
-
86
- case Spliced ( Quoted (quotedTree)) =>
87
- transform(quotedTree) // ~('x) --> x
87
+ dropEmptyBlocks (quotedTree) match {
88
+ case Spliced (t) => transform(t) // '{ $x } --> x
89
+ case _ => transformQuotation(quotedTree, tree)
90
+ }
88
91
89
- case tree @ Spliced (_) =>
90
- transformSplice(tree)
92
+ case tree @ Spliced (splicedTree) =>
93
+ dropEmptyBlocks(splicedTree) match {
94
+ case Quoted (t) => transform(t) // ${ 'x } --> x
95
+ case _ => transformSplice(tree)
96
+ }
91
97
92
98
case Block (stats, _) =>
93
99
val last = enteredSyms
You can’t perform that action at this time.
0 commit comments