Skip to content

Commit 1942128

Browse files
committed
Scala 2.11 compatibility
We were relying on an internal API that no longer exists.
1 parent 77b5949 commit 1942128

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/main/scala/scala/async/internal/AnfTransform.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,21 @@ private[async] trait AnfTransform {
203203
}
204204
}
205205

206-
val typedNewApply = copyApplied(tree, treeInfo.dissectApplied(tree).applyDepth)
206+
207+
/** The depth of the nested applies: e.g. Apply(Apply(Apply(_, _), _), _)
208+
* has depth 3. Continues through type applications (without counting them.)
209+
*/
210+
def applyDepth: Int = {
211+
def loop(tree: Tree): Int = tree match {
212+
case Apply(fn, _) => 1 + loop(fn)
213+
case TypeApply(fn, _) => loop(fn)
214+
case AppliedTypeTree(fn, _) => loop(fn)
215+
case _ => 0
216+
}
217+
loop(tree)
218+
}
219+
220+
val typedNewApply = copyApplied(tree, applyDepth)
207221

208222
funStats ++ argStatss.flatten.flatten :+ typedNewApply
209223

0 commit comments

Comments
 (0)