45a0873afa
The problem was in the "more specific" relation, that didn't pay enough attention to varargs. The correct behavior is in the spirit of JLS 15.12.2 (as of Java 5): * a fixed-arity function always wins over a variable-arity functions * if two vararg functions are compared, their parameters are checked for subtyping. In the latter case, the candidates may have different number of formal parameters, so we compare the matching parts and then check the rest against the vararg parameter. #KT-1835 Fixed
19 lines
474 B
Plaintext
19 lines
474 B
Plaintext
// FILE: kotlin.kt
|
|
fun main(j : C, s : Array<String?>) {
|
|
j.from()
|
|
j.from("")
|
|
j.from("", "")
|
|
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from("", "", "")<!>
|
|
|
|
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from("", *s)<!> // This should not be an ambiguity, see KT-1842
|
|
j.from(*s)
|
|
}
|
|
|
|
// FILE: C.java
|
|
public class C {
|
|
void from() {}
|
|
void from(String s) {}
|
|
void from(String s, String s1) {}
|
|
void from(String... s) {}
|
|
void from(String s1, String... s) {}
|
|
} |