Files
kotlin-fork/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolution.fir.kt
T
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00

37 lines
916 B
Kotlin
Vendored

// !CHECK_TYPE
// FILE: A.java
public class A {
public int foo(Runnable r) { return 0; }
public String foo(Object r) { return null;}
public int bar(Runnable r) { return 1; }
public String bar(CharSequence r) { return null; }
}
// FILE: 1.kt
fun fn() {}
fun x(a: A, 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)
}