[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,32 +0,0 @@
//If this test hangs, it means something is broken.
object A {
val iii = 42
}
//inappropriate but participating in resolve functions
fun foo(s: String, a: Any) = s + a
fun foo(a: Any) = a
fun foo(i: Int) = i
fun foo(a: Any, i: Int, f: ()-> Int) = "$a$i${f()}"
fun foo(f: (Int)->Int, i: Int) = f(i)
fun foo(f: (String)->Int, s: String) = f(s)
fun foo(f: (Any)->Int, a: Any) = f(a)
fun foo(s: String, f: (String, String)->Int) = f(s, s)
//appropriate function
fun foo(i: Int, f: (Int)->Int) = f(i)
fun <T> id(t: T) = t
fun test() {
<!INAPPLICABLE_CANDIDATE!>foo<!>(1, id { x1 ->
<!INAPPLICABLE_CANDIDATE!>foo<!>(2, id { x2 ->
<!INAPPLICABLE_CANDIDATE!>foo<!>(3, id { x3 ->
<!INAPPLICABLE_CANDIDATE!>foo<!>(4, id { x4 ->
<!INAPPLICABLE_CANDIDATE!>foo<!>(5, id { x5 ->
x1 + x2 + x3 + x4 + x5 + A.iii
})
})
})
})
})
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//If this test hangs, it means something is broken.
object A {
val iii = 42
@@ -22,11 +22,11 @@ fun foo(i: Int, f: (Int) -> Int) = f(i)
fun <T> id(t: T) = t
fun test() {
foo(1, id(fun(x1: Int) =
foo(2, id(fun(x2: Int) =
foo(3, id(fun(x3: Int) =
foo(4, id(fun(x4: Int) =
foo(5, id(fun(x5: Int) =
<!AMBIGUITY!>foo<!>(1, id(fun(x1: Int) =
<!AMBIGUITY!>foo<!>(2, id(fun(x2: Int) =
<!AMBIGUITY!>foo<!>(3, id(fun(x3: Int) =
<!AMBIGUITY!>foo<!>(4, id(fun(x4: Int) =
<!AMBIGUITY!>foo<!>(5, id(fun(x5: Int) =
x1 + x2 + x3 + x4 + x5 + A.iii
))
))