scala/scala — pull request #3615 by retronym (2014-03-10 17:30:48+00:00)
Title: SI-8376 Fix overload resolution with Java varargs

When comparing specificity of two vararg `MethodTypes`, `isAsSpecific`
gets to:

```
case mt @ MethodType(_, _) if bothAreVarargs =>
checkIsApplicable(mt.paramTypes mapConserve repeatedToSingle)
```

The formal parameter type of a Java varargs parameter is represented
as `tq"${defintions.JavaRepeatedParamClass}[$elemTp]"`. For a Scala
repeated parameter, we instead use `defintions.RepeatedParamClass`.

`bothAreVarargs` detects `JavaRepeatedParamClass`, by virtue of:

```
def isRepeatedParamType(tp: Type) = isScalaRepeatedParamType(tp) || isJavaRepeatedParamType(tp)
```

But, `repeatedToSingle` only considers `RepeatedParamClass`.

This bug was ostensibly masked in 2.10.3, but became apparent after
a not-quite-refactoring in 0fe56b9770. It would be good to pin that
change down to a particular line, but I haven't managed that yet.

Review by @adriaanm / @gkossakowski.

I'll look at 0fe56b9770 a bit more tomorrow to try to explain why this
ever worked in to 2.10.3.