diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-21 16:36:10 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-26 16:24:01 +0100 |
commit | e3b0fa2ede56393165759eecd7bc916d24835ee1 (patch) | |
tree | b543110c5a16cb452b41488b4a3ccfb26345426a | |
parent | f590cb3564e47f212ba0b8c6d69c2d0f86108de9 (diff) | |
download | dotty-e3b0fa2ede56393165759eecd7bc916d24835ee1.tar.gz dotty-e3b0fa2ede56393165759eecd7bc916d24835ee1.tar.bz2 dotty-e3b0fa2ede56393165759eecd7bc916d24835ee1.zip |
Fix flatten problem in erasure
Statement sequences need to be flattened after processing, not before.
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index ed853f8f1..198e9b621 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -183,6 +183,7 @@ object Erasure extends TypeTestsCasts{ } /** Generate a synthetic cast operation from tree.tpe to pt. + * Does not do any boxing/unboxing (this is handled upstream). */ def cast(tree: Tree, pt: Type)(implicit ctx: Context): Tree = { // TODO: The commented out assertion fails for tailcall/t6574.scala @@ -315,7 +316,7 @@ object Erasure extends TypeTestsCasts{ override def typedThis(tree: untpd.This)(implicit ctx: Context): Tree = if (tree.symbol == ctx.owner.enclosingClass || tree.symbol.isStaticOwner) promote(tree) else { - ctx.log(i"computing outer path from ${ctx.owner.ownersIterator.toList}%, % to ${tree.symbol}") + ctx.log(i"computing outer path from ${ctx.owner.ownersIterator.toList}%, % to ${tree.symbol}, encl class = ${ctx.owner.enclosingClass}") outer.path(tree.symbol) } @@ -377,10 +378,8 @@ object Erasure extends TypeTestsCasts{ EmptyTree override def typedStats(stats: List[untpd.Tree], exprOwner: Symbol)(implicit ctx: Context): List[Tree] = { - val statsFlatten = Trees.flatten(stats) - val stats1 = super.typedStats(statsFlatten, exprOwner) - - if (ctx.owner.isClass) stats1:::addBridges(statsFlatten, stats1)(ctx) else stats1 + val stats1 = Trees.flatten(super.typedStats(stats, exprOwner)) + if (ctx.owner.isClass) stats1 ::: addBridges(stats, stats1)(ctx) else stats1 } // this implementation doesn't check for bridge clashes with value types! |