[FIR] Improved lambda completion: initial implementation
Repeat the logic of KotlinConstraintSystemCompleter in ConstraintSystemCompleter. Implement additional context operations required for updated lambda completion algorithm.
This commit is contained in:
Vendored
-36
@@ -1,36 +0,0 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
//If this test hangs, it means something is broken.
|
||||
package a
|
||||
|
||||
object A {
|
||||
val iii = 42
|
||||
}
|
||||
|
||||
//inappropriate but participating in resolve functions
|
||||
fun foo(s: String, a: Any) = s + a
|
||||
fun foo(a: Any, s: String) = s + a
|
||||
fun foo(i: Int, j: Int) = i + j
|
||||
fun foo(a: Any, i: Int) = "$a$i"
|
||||
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) -> Int) = f(s)
|
||||
fun foo(a: Any, f: (Any) -> Int) = f(a)
|
||||
//appropriate function
|
||||
fun foo(i: Int, f: (Int) -> Int) = f(i)
|
||||
|
||||
fun <T> id(t: T) = t
|
||||
|
||||
fun test() {
|
||||
<!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
|
||||
))
|
||||
))
|
||||
))
|
||||
))
|
||||
))
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !WITH_NEW_INFERENCE
|
||||
//If this test hangs, it means something is broken.
|
||||
package a
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@
|
||||
fun <T: Any> foo(f: (T) -> Unit): T? = null // T is used only as return type
|
||||
fun test() {
|
||||
val x = foo { it checkType { _<String>() }} ?: "" // foo() is inferred as foo<String>, which isn't very good
|
||||
val y: Any = foo { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>it<!> checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Any>() } } ?: "" // but for now it's fixed by specifying expected type
|
||||
val y: Any = foo { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>it<!> checkType { _<Any>() } } ?: "" // but for now it's fixed by specifying expected type
|
||||
}
|
||||
Reference in New Issue
Block a user