Files
kotlin-fork/compiler/testData/diagnostics/tests/samConversions/GenericSubstitutionKT.kt
T
Stanislav Erokhin 8f0b073c08 [NI] Prototype for SAM-conversion.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
2018-06-04 12:21:56 +03:00

27 lines
605 B
Kotlin
Vendored

// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions
// !CHECK_TYPE
// FILE: F.java
public interface F<S> {
void apply(S s);
}
// FILE: PR.java
public interface PR<X, Y> {}
// FILE: 1.kt
interface K<T> {
fun f_t(f1: F<T>, f2: F<T>)
fun <R> f_r(f1: F<R>, f2: F<R>)
fun <R> f_pr(f1: F<PR<T, R>>, f2: F<PR<T, R>>)
}
fun test(
k: K<String>,
f_string: F<String>,
f_int: F<Int>,
f_pr: F<PR<String, Int>>
) {
k.f_t(f_string) { it checkType { _<String>() } }
k.f_r(f_int) { it checkType { _<Int>() } }
k.f_pr(f_pr) { it checkType { _<PR<String, Int>>() } }
}