diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 18:19:19 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 18:19:19 +0100 |
commit | db5fd4638c0aac51d66244404dad4dd779f184fa (patch) | |
tree | 3b39cc69e904d3021a1cbd19c31d101d48c5dbb5 /src/main/scala | |
parent | f9c25fc4acac6a5965d68584d68eee7539e4ba45 (diff) | |
download | scala-async-db5fd4638c0aac51d66244404dad4dd779f184fa.tar.gz scala-async-db5fd4638c0aac51d66244404dad4dd779f184fa.tar.bz2 scala-async-db5fd4638c0aac51d66244404dad4dd779f184fa.zip |
Test for await in while (currently forbidden).
Lookup the ValDef symbol from Assign#rhs.symbol.
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/scala/async/AsyncAnalysis.scala | 4 | ||||
-rw-r--r-- | src/main/scala/scala/async/ExprBuilder.scala | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/main/scala/scala/async/AsyncAnalysis.scala b/src/main/scala/scala/async/AsyncAnalysis.scala index c160776..88a1bb0 100644 --- a/src/main/scala/scala/async/AsyncAnalysis.scala +++ b/src/main/scala/scala/async/AsyncAnalysis.scala @@ -102,10 +102,10 @@ private[async] final case class AsyncAnalysis[C <: Context](override val c: C) e if (isAwait(vd.rhs)) valDefsToLift += vd case as: Assign => if (isAwait(as.rhs)) { - assert(as.symbol != null, "internal error: null symbol for Assign tree:" + as) + assert(as.lhs.symbol != null, "internal error: null symbol for Assign tree:" + as + " " + as.lhs.symbol) // TODO test the orElse case, try to remove the restriction. - val (vd, defBlockId) = valDefChunkId.getOrElse(as.symbol, c.abort(as.pos, "await may only be assigned to a var/val defined in the async block. " + as.symbol)) + val (vd, defBlockId) = valDefChunkId.getOrElse(as.lhs.symbol, c.abort(as.pos, s"await may only be assigned to a var/val defined in the async block. ${as.lhs} ${as.lhs.symbol}")) valDefsToLift += vd } super.traverse(tree) diff --git a/src/main/scala/scala/async/ExprBuilder.scala b/src/main/scala/scala/async/ExprBuilder.scala index 4b81d1e..8ea7ecf 100644 --- a/src/main/scala/scala/async/ExprBuilder.scala +++ b/src/main/scala/scala/async/ExprBuilder.scala @@ -269,7 +269,7 @@ final case class ExprBuilder[C <: Context, FS <: FutureSystem](override val c: C def checkForUnsupportedAwait(tree: c.Tree) = if (tree exists { case Apply(fun, _) if isAwait(fun) => true case _ => false - }) c.abort(tree.pos, "await unsupported in this position") //throw new FallbackToCpsException + }) c.abort(tree.pos, "await must not be used in this position") //throw new FallbackToCpsException def builderForBranch(tree: c.Tree, state: Int, nextState: Int): AsyncBlockBuilder = { val (branchStats, branchExpr) = tree match { |