aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/TreeInterrogation.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-27 08:36:26 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-27 09:00:33 +0100
commit7c93a9e0e288b55027646016913c7368732d54e4 (patch)
treea4f4a2b8a6848577bae9f82805ffb61fe9b25e00 /src/test/scala/scala/async/TreeInterrogation.scala
parent38c362b45fa3f5ae006ebdebaaf163c701313967 (diff)
downloadscala-async-7c93a9e0e288b55027646016913c7368732d54e4.tar.gz
scala-async-7c93a9e0e288b55027646016913c7368732d54e4.tar.bz2
scala-async-7c93a9e0e288b55027646016913c7368732d54e4.zip
No need to extract vals for inlinable args.
We use `isExprSafeToInline` from the non-public reflection API to check. In addtion, we now that an untyped Ident("await$N") is also an inlinable expression.
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 ecb1bca..b22faa9 100644
--- a/src/test/scala/scala/async/TreeInterrogation.scala
+++ b/src/test/scala/scala/async/TreeInterrogation.scala
@@ -70,17 +70,15 @@ object TreeInterrogation extends App {
val cm = reflect.runtime.currentMirror
val tb = mkToolbox("-cp target/scala-2.10/classes -Xprint:all")
val tree = tb.parse(
- """
- | import scala.async.Async.{async, await}
- | import scala.concurrent.{future, ExecutionContext, Await}
- | import ExecutionContext.Implicits._
- | import scala.concurrent.duration._
- |
- | try {
- | val f = async { throw new Exception("problem") }
- | Await.result(f, 1.second)
- | } catch {
- | case ex: Exception if ex.getMessage == "problem" => // okay
+ """ 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()))
| }
| ()
| """.stripMargin)