[FIR] Support completion of lambdas with type variable as expected type

#KT-37310 Fixed
#KT-37304 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-03-06 14:11:31 +03:00
parent 643d7be12d
commit 1c0fd7342f
28 changed files with 281 additions and 186 deletions
@@ -1,37 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
class B {
class Builder
}
typealias ApplyRestrictions = B.Builder.() -> B.Builder
fun applyRestrictions1(): ApplyRestrictions = TODO()
fun applyRestrictions2() = applyRestrictions1()
fun <K> applyRestrictions3(e: K) = applyRestrictions1()
fun buildB() {
val a1 = applyRestrictions1()
val a2 = applyRestrictions2()
val a3 = applyRestrictions3("foo")
B.Builder().a1()
B.Builder().a2()
B.Builder().a3()
}
// additional example from #KT-34820
class R
class P
typealias F = R.(P) -> Unit
fun guess(): F? = TODO()
fun consume(f: F) {}
fun problem() {
val p = guess()
<!INAPPLICABLE_CANDIDATE!>consume<!>(p ?: {})
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER