Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/generic/nestedCallWithOverload.kt
T
Mikhail Zarechenskiy 2cac6a9e7d Improve inference on generics for callable references
#KT-10711 Fixed
 #KT-12802 Fixed
 #KT-12964 Fixed
 #KT-15439 Fixed

Analyze callable references in `dependent` mode, then complete them with
respect to expected types
2017-01-24 02:15:26 +03:00

21 lines
705 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
fun foo(i: Int) {}
fun foo(s: String) {}
fun <T> id(x: T): T = x
fun <T> baz(x: T, y: T): T = TODO()
fun test() {
val x1: (Int) -> Unit = id(id(::foo))
val x2: (Int) -> Unit = baz(id(::foo), ::foo)
val x3: (Int) -> Unit = baz(id(::foo), id(id(::foo)))
val x4: (String) -> Unit = baz(id(::foo), id(id(::foo)))
val x5: (Double) -> Unit = baz(id(::<!NONE_APPLICABLE!>foo<!>), id(id(::<!NONE_APPLICABLE!>foo<!>)))
id<(Int) -> Unit>(id(id(::foo)))
id(id<(Int) -> Unit>(::foo))
baz<(Int) -> Unit>(id(::foo), id(id(::foo)))
baz(id(::foo), id(id<(Int) -> Unit>(::foo)))
baz(id(::foo), id<(Int) -> Unit>(id(::foo)))
}