Files
kotlin-fork/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt
T
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00

30 lines
920 B
Kotlin
Vendored

// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument
// !CHECK_TYPE
// FILE: Fn.java
public interface Fn<T, R> {
R apply(T t);
}
// FILE: Fn2.java
public interface Fn2<T, R> extends Fn<T, R> {}
// FILE: 1.kt
interface K {
fun foo(f: Fn<String, Any>): String
fun foo(f: Fn<Any, Any>): Int
fun bas(f: Fn<Any, Any>): String
fun bas(f: Fn<Any, String>): Int
fun bar(f: Fn<String, Any>): String
fun bar(f: Fn2<String, Any>): Int
}
fun test(k: K) {
k.foo { it checkType { _<Any>() }; "" } checkType { _<Int>() }
k.bas { it checkType { _<Any?>() }; "" } checkType { _<Int>() }
// NI: TODO
k.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!> { <!UNRESOLVED_REFERENCE!>it<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Any>() }; "" } <!DEBUG_INFO_MISSING_UNRESOLVED!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}