From 74beb1b751f6abf1775d6a8ec3eea4d63f3fd41f Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 10 Apr 2013 17:55:27 +0200 Subject: Scala 2.10.1 compat: apply renaming to originals of TypeTrees This time in the ANF/Inline transformation. --- src/main/scala/scala/async/AnfTransform.scala | 5 ++++ .../scala/async/run/anf/AnfTransformSpec.scala | 35 +++++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/scala/scala/async/AnfTransform.scala b/src/main/scala/scala/async/AnfTransform.scala index afcf6bd..c5fbfd7 100644 --- a/src/main/scala/scala/async/AnfTransform.scala +++ b/src/main/scala/scala/async/AnfTransform.scala @@ -88,6 +88,11 @@ private[async] final case class AnfTransform[C <: Context](c: C) { if (renamed(tree.symbol)) { treeCopy.Select(tree, transform(fun), tree.symbol.name) } else super.transform(tree) + case tt: TypeTree => + val tt1 = tt.asInstanceOf[symtab.TypeTree] + val orig = tt1.original + if (orig != null) tt1.setOriginal(transform(orig.asInstanceOf[Tree]).asInstanceOf[symtab.Tree]) + super.transform(tt) case _ => super.transform(tree) } } diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala index 03db205..41c13e0 100644 --- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala +++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala @@ -112,24 +112,23 @@ class AnfTransformSpec { State.result mustBe (14) } -// TODO 2.10.1 -// @Test -// def `inlining block does not produce duplicate definition`() { -// import scala.async.AsyncId -// -// AsyncId.async { -// val f = 12 -// val x = AsyncId.await(f) -// -// { -// type X = Int -// val x: X = 42 -// println(x) -// } -// type X = Int -// x: X -// } -// } + @Test + def `inlining block does not produce duplicate definition`() { + import scala.async.AsyncId + + AsyncId.async { + val f = 12 + val x = AsyncId.await(f) + + { + type X = Int + val x: X = 42 + println(x) + } + type X = Int + x: X + } + } @Test def `inlining block in tail position does not produce duplicate definition`() { -- cgit v1.2.3