aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/TreeInterrogation.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-10 11:44:39 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-10 11:44:39 +0100
commit8b7e520b7d66abe14560508a24fe88d99fbedd9e (patch)
tree0b3bc74cbe02c6603d845c81fae53e4f69815eaf /src/test/scala/scala/async/TreeInterrogation.scala
parent7c93a9e0e288b55027646016913c7368732d54e4 (diff)
downloadscala-async-8b7e520b7d66abe14560508a24fe88d99fbedd9e.tar.gz
scala-async-8b7e520b7d66abe14560508a24fe88d99fbedd9e.tar.bz2
scala-async-8b7e520b7d66abe14560508a24fe88d99fbedd9e.zip
Workaround non-idempotency of typing pattern matching anonymous functions.
- Undo the transformation that takes place in Typers to leave us with Match(EmptyTree, cases). - Make sure we don't descend into the cases of such a tree when peforming the async transform
Diffstat (limited to 'src/test/scala/scala/async/TreeInterrogation.scala')
-rw-r--r--src/test/scala/scala/async/TreeInterrogation.scala20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala
index b22faa9..93cfdf5 100644
--- a/src/test/scala/scala/async/TreeInterrogation.scala
+++ b/src/test/scala/scala/async/TreeInterrogation.scala
@@ -62,23 +62,21 @@ object TreeInterrogation extends App {
val levels = Seq("trace", "debug")
def setAll(value: Boolean) = levels.foreach(set(_, value))
- setAll(true)
- try t finally setAll(false)
+ setAll(value = true)
+ try t finally setAll(value = false)
}
withDebug {
val cm = reflect.runtime.currentMirror
- val tb = mkToolbox("-cp target/scala-2.10/classes -Xprint:all")
+ val tb = mkToolbox("-cp target/scala-2.10/classes -Xprint:flatten")
val tree = tb.parse(
""" import scala.async.AsyncId.{async, await}
- | def foo(a: Int, b: Int) = (a, b)
- | val result = async {
- | var i = 0
- | def next() = {
- | i += 1;
- | i
- | }
- | foo(next(), await(next()))
+ | 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))
| }
| ()
| """.stripMargin)