f283f2db43
Also introduce few new diagnostics: - NONE_APPLICABLE more many inapplicable candidates - HIDDEN for visible candidates
37 lines
938 B
Kotlin
Vendored
37 lines
938 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
// FILE: A.java
|
|
public class A {
|
|
public static int foo(Runnable r) { return 0; }
|
|
public static String foo(Object r) { return null;}
|
|
|
|
public static int bar(Runnable r) { return 1; }
|
|
public static String bar(CharSequence r) { return null; }
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
fun fn() {}
|
|
fun x(r: Runnable) {
|
|
A.foo(::fn) checkType { _<Int>() }
|
|
A.foo {} checkType { _<Int>() }
|
|
|
|
A.foo(null) checkType { _<Int>() }
|
|
A.foo(Runnable { }) checkType { _<Int>() }
|
|
A.foo(r) checkType { _<Int>() }
|
|
|
|
A.foo(123) checkType { _<String>() }
|
|
A.foo("") checkType { _<String>() }
|
|
|
|
A.bar(::fn) checkType { _<Int>() }
|
|
A.bar {} checkType { _<Int>() }
|
|
|
|
A.bar(r) checkType { _<Int>() }
|
|
|
|
A.<!AMBIGUITY!>bar<!>(null)
|
|
|
|
A.bar(null as Runnable?) checkType { _<Int>() }
|
|
A.bar(null as CharSequence?) checkType { _<String>() }
|
|
|
|
A.bar("") checkType { _<String>() }
|
|
A.<!NONE_APPLICABLE!>bar<!>(123)
|
|
}
|