Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/generic/resolutionWithGenericCallable.kt
T
2019-10-23 18:52:53 +03:00

23 lines
994 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun test() {
val a1: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Double::minus)
val a2: Array<Double.(Int) -> Double> = arrayOf(Double::plus, Double::minus)
val a3: Array<Int.(Int) -> Double> = arrayOf(Double::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, OI;NONE_APPLICABLE!>plus<!>, Double::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, OI;NONE_APPLICABLE!>minus<!>)
val a4: Array<Int.(Double) -> Double> = arrayOf(Int::plus, Double::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, OI;NONE_APPLICABLE!>minus<!>)
val a5: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Int::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, OI;NONE_APPLICABLE!>minus<!>)
}
fun foo(x: Int) {}
fun foo(y: String) {}
fun <T> bar(x: T, f: (T) -> Unit) {}
fun test2() {
bar(1, ::foo)
bar("", ::foo)
bar(1.0, ::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, OI;NONE_APPLICABLE!>foo<!>)
}