diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-10 17:24:09 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-10 18:03:24 +0200 |
commit | b60346cda87a4b2213d9b779ed4c6241f126647d (patch) | |
tree | 25d02b3bcca49879b37265c6f71d63337adbc0e1 /src/test | |
parent | d332b4614dfd07b4fd91576dac3ff3fddd657106 (diff) | |
download | scala-async-b60346cda87a4b2213d9b779ed4c6241f126647d.tar.gz scala-async-b60346cda87a4b2213d9b779ed4c6241f126647d.tar.bz2 scala-async-b60346cda87a4b2213d9b779ed4c6241f126647d.zip |
Scala 2.10.1 compat: account for change in PartialFunction synthesis.
Since SI-6187, the default case of a partial function is now included in the tree.
Before, it was a tree attachment, conditionally inserted in the pattern matcher.
I had hoped that that change would allow us to do away with
`RestorePatternMatchingFunctions` altogether, but it seems that
we aren't so lucky.
Instead, I've adapted that transformer to account for the new scheme.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/scala/scala/async/run/toughtype/ToughType.scala | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/test/scala/scala/async/run/toughtype/ToughType.scala b/src/test/scala/scala/async/run/toughtype/ToughType.scala index ab0b60d..83f5a2d 100644 --- a/src/test/scala/scala/async/run/toughtype/ToughType.scala +++ b/src/test/scala/scala/async/run/toughtype/ToughType.scala @@ -37,28 +37,26 @@ class ToughTypeSpec { res._1 mustBe (Nil) } -// TODO 2.10.1 -// @Test def patternMatchingPartialFunction() { -// import AsyncId.{await, async} -// async { -// await(1) -// val a = await(1) -// val f = { case x => x + a }: PartialFunction[Int, Int] -// await(f(2)) -// } mustBe 3 -// } + @Test def patternMatchingPartialFunction() { + import AsyncId.{await, async} + async { + await(1) + val a = await(1) + val f = { case x => x + a }: PartialFunction[Int, Int] + await(f(2)) + } mustBe 3 + } -// TODO 2.10.1 -// @Test def patternMatchingPartialFunctionNested() { -// import AsyncId.{await, async} -// async { -// await(1) -// val neg1 = -1 -// val a = await(1) -// val f = { case x => ({case x => neg1 * x}: PartialFunction[Int, Int])(x + a) }: PartialFunction[Int, Int] -// await(f(2)) -// } mustBe -3 -// } + @Test def patternMatchingPartialFunctionNested() { + import AsyncId.{await, async} + async { + await(1) + val neg1 = -1 + val a = await(1) + val f = { case x => ({case x => neg1 * x}: PartialFunction[Int, Int])(x + a) }: PartialFunction[Int, Int] + await(f(2)) + } mustBe -3 + } @Test def patternMatchingFunction() { import AsyncId.{await, async} |