summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-09-12 14:14:15 +0000
committerPaul Phillips <paulp@improving.org>2011-09-12 14:14:15 +0000
commite8aee14bbdefe2936d17520a9bb53d16ebc487de (patch)
treee5bcca7bc009e1f15b40e8d2839a263a88be35cd /src
parentaaaa019588d0c2b10d74f7c38fd9dee9f970404b (diff)
downloadscala-e8aee14bbdefe2936d17520a9bb53d16ebc487de.tar.gz
scala-e8aee14bbdefe2936d17520a9bb53d16ebc487de.tar.bz2
scala-e8aee14bbdefe2936d17520a9bb53d16ebc487de.zip
Fix for params/args zip IOOB crash.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/TreeInfo.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/internal/TreeInfo.scala b/src/compiler/scala/reflect/internal/TreeInfo.scala
index 248cee8de8..6ee976a55d 100644
--- a/src/compiler/scala/reflect/internal/TreeInfo.scala
+++ b/src/compiler/scala/reflect/internal/TreeInfo.scala
@@ -116,7 +116,14 @@ abstract class TreeInfo {
*/
def zipMethodParamsAndArgs(t: Tree): List[(Symbol, Tree)] = t match {
case Apply(fn, args) =>
- val params = fn.symbol.paramss(applyDepth(fn))
+ val depth = applyDepth(fn)
+ // There could be applies which go beyond the parameter list(s),
+ // being applied to the result of the method call.
+ val params = (
+ if (depth < fn.symbol.paramss.size) fn.symbol.paramss(depth)
+ else if (fn.symbol.paramss.isEmpty) Nil
+ else fn.symbol.paramss.last
+ )
val plen = params.length
val alen = args.length
def fail() = {