Skip to content

Commit 4bab817

Browse files
committed
Drop blocks with empty statements from inlined expansions
1 parent 3e72e33 commit 4bab817

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
602602
newOwners = ctx.owner :: Nil,
603603
substFrom = ddef.vparamss.head.map(_.symbol),
604604
substTo = argSyms)
605-
Block(bindingsBuf.toList, expander.transform(ddef.rhs))
605+
seq(bindingsBuf.toList, expander.transform(ddef.rhs))
606606
case _ => tree
607607
}
608608
case _ => tree
@@ -885,6 +885,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
885885
case t: Apply =>
886886
val t1 = super.transform(t)
887887
if (t1 `eq` t) t else reducer.betaReduce(t1)
888+
case Block(Nil, expr) =>
889+
super.transform(expr)
888890
case _ =>
889891
super.transform(t)
890892
}

compiler/src/dotty/tools/dotc/util/Set.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* NSC -- new Scala compiler
2-
* Copyright 2005-2012 LAMP/EPFL
3-
* @author Martin Odersky
4-
*/
51
package dotty.tools.dotc.util
62

73
/** A common class for lightweight sets.

0 commit comments

Comments
 (0)