diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-26 14:05:04 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-26 16:25:16 +0100 |
commit | be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4 (patch) | |
tree | 70426486df39db37860ab90f15ecb41ff51994c1 /src/test/scala/scala/async/TreeInterrogation.scala | |
parent | 4da04eee1893ead433a624f6b146d56aca46cb7e (diff) | |
download | scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.tar.gz scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.tar.bz2 scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.zip |
Rewrite the state machine to a class, rather than an object.
To avoid suprises in tree retyping, the instance of this
class is immediately upcase to
StateMachine[Promise[T], ExecContext].
Allow nested non-case classes. These pop up when
we use nested async calls.
Only look for duplicate names in the subtrees
traversed by AsyncTraverser.
Diffstat (limited to 'src/test/scala/scala/async/TreeInterrogation.scala')
-rw-r--r-- | src/test/scala/scala/async/TreeInterrogation.scala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala index 14749ca..9a31337 100644 --- a/src/test/scala/scala/async/TreeInterrogation.scala +++ b/src/test/scala/scala/async/TreeInterrogation.scala @@ -57,11 +57,21 @@ object TreeInterrogation extends App { val tb = mkToolbox("-cp target/scala-2.10/classes -Xprint:all") val tree = tb.parse( """ import _root_.scala.async.AsyncId._ - | async { val a = 0; val x = await(a) - 1; def foo(z: Any) = (a.toDouble, x.toDouble, z); foo(await(2)) } + | val state = 23 + | val result: Any = "result" + | def resume(): Any = "resume" + | val res = async { + | val f1 = async { state + 2 } + | val x = await(f1) + | val y = await(async { result }) + | val z = await(async { resume() }) + | (x, y, z) + | } + | () | """.stripMargin) println(tree) val tree1 = tb.typeCheck(tree.duplicate) println(cm.universe.show(tree1)) println(tb.eval(tree)) } -}
\ No newline at end of file +} |