aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-04-10 17:55:27 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-04-10 18:03:24 +0200
commit74beb1b751f6abf1775d6a8ec3eea4d63f3fd41f (patch)
treeff7faffab9c3bb91c6f698ab38766676abe767a7
parentb60346cda87a4b2213d9b779ed4c6241f126647d (diff)
downloadscala-async-74beb1b751f6abf1775d6a8ec3eea4d63f3fd41f.tar.gz
scala-async-74beb1b751f6abf1775d6a8ec3eea4d63f3fd41f.tar.bz2
scala-async-74beb1b751f6abf1775d6a8ec3eea4d63f3fd41f.zip
Scala 2.10.1 compat: apply renaming to originals of TypeTrees
This time in the ANF/Inline transformation.
-rw-r--r--src/main/scala/scala/async/AnfTransform.scala5
-rw-r--r--src/test/scala/scala/async/run/anf/AnfTransformSpec.scala35
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`() {