c2cf4aa2b5
If new inference is enabled only for IDE analysis, then this feature will be disabled to reduce difference between new and old inference, but if new inference is enabled in the compiler, then this feature will be enabled too to preserve behavior of new inference for compilation #KT-32175 Fixed #KT-32143 Fixed #KT-32123 Fixed #KT-32230 Fixed
30 lines
930 B
Kotlin
Vendored
30 lines
930 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_ELEMENT_WITH_ERROR_TYPE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Any>() }; "" } <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
|
} |