aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-07 09:26:53 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-07 09:37:04 +0100
commit61efba27ee97be3b8332e9c7b3f1403813e70a97 (patch)
treebb7af34404b6b87547c75fc8a22f7d4cc1b4460d /src
parent77b59499c87230c4c183cfee3734d11941930609 (diff)
downloadscala-async-61efba27ee97be3b8332e9c7b3f1403813e70a97.tar.gz
scala-async-61efba27ee97be3b8332e9c7b3f1403813e70a97.tar.bz2
scala-async-61efba27ee97be3b8332e9c7b3f1403813e70a97.zip
Scala 2.11 compatibility
We were relying on an internal API that no longer exists. We also need to tweak the way our tests infer scalaBinaryVersion.
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/scala/async/internal/AnfTransform.scala16
-rw-r--r--src/test/scala/scala/async/package.scala2
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/scala/scala/async/internal/AnfTransform.scala b/src/main/scala/scala/async/internal/AnfTransform.scala
index f7f691d..f19a87a 100644
--- a/src/main/scala/scala/async/internal/AnfTransform.scala
+++ b/src/main/scala/scala/async/internal/AnfTransform.scala
@@ -203,7 +203,21 @@ private[async] trait AnfTransform {
}
}
- val typedNewApply = copyApplied(tree, treeInfo.dissectApplied(tree).applyDepth)
+
+ /** The depth of the nested applies: e.g. Apply(Apply(Apply(_, _), _), _)
+ * has depth 3. Continues through type applications (without counting them.)
+ */
+ def applyDepth: Int = {
+ def loop(tree: Tree): Int = tree match {
+ case Apply(fn, _) => 1 + loop(fn)
+ case TypeApply(fn, _) => loop(fn)
+ case AppliedTypeTree(fn, _) => loop(fn)
+ case _ => 0
+ }
+ loop(tree)
+ }
+
+ val typedNewApply = copyApplied(tree, applyDepth)
funStats ++ argStatss.flatten.flatten :+ typedNewApply
diff --git a/src/test/scala/scala/async/package.scala b/src/test/scala/scala/async/package.scala
index 7c42024..98d2256 100644
--- a/src/test/scala/scala/async/package.scala
+++ b/src/test/scala/scala/async/package.scala
@@ -43,8 +43,10 @@ package object async {
}
def scalaBinaryVersion: String = {
+ val PreReleasePattern = """.*-(M|RC).*""".r
val Pattern = """(\d+\.\d+)\..*""".r
scala.util.Properties.versionNumberString match {
+ case s @ PreReleasePattern(_) => s
case Pattern(v) => v
case _ => ""
}