aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-27 17:42:40 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-27 17:44:38 +0100
commitc79d8c07d194aeaa0565f2c136b8308519d59015 (patch)
tree01cdb87f6ae7d67921994e0540035462122c1aa3 /src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
parent5ee41166ea1684672ddb9a0d605a664661ba5f47 (diff)
downloadscala-async-c79d8c07d194aeaa0565f2c136b8308519d59015.tar.gz
scala-async-c79d8c07d194aeaa0565f2c136b8308519d59015.tar.bz2
scala-async-c79d8c07d194aeaa0565f2c136b8308519d59015.zip
Fix ANF transform involving `xs: _*` trees.
We need to unwrap and inline `xs`, then rewrap the result expression with the wildcard star. Addresses the first half of #46.
Diffstat (limited to 'src/test/scala/scala/async/run/anf/AnfTransformSpec.scala')
-rw-r--r--src/test/scala/scala/async/run/anf/AnfTransformSpec.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
index 529386b..41c13e0 100644
--- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
+++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
@@ -289,4 +289,26 @@ class AnfTransformSpec {
foo(a = await(next()))
} mustBe ((1, 2))
}
+
+ @Test
+ def repeatedParams1() {
+ import scala.async.AsyncId.{async, await}
+ var i = 0
+ def foo(a: Int, b: Int*) = b.toList
+ def id(i: Int) = i
+ async {
+ foo(await(0), id(1), id(2), id(3), await(4))
+ } mustBe (List(1, 2, 3, 4))
+ }
+
+ @Test
+ def repeatedParams2() {
+ import scala.async.AsyncId.{async, await}
+ var i = 0
+ def foo(a: Int, b: Int*) = b.toList
+ def id(i: Int) = i
+ async {
+ foo(await(0), List(id(1), id(2), id(3)): _*)
+ } mustBe (List(1, 2, 3))
+ }
}