FIR: Fix false positive INAPPLICABLE_INFIX_MODIFIER

This commit is contained in:
Denis Zharkov
2020-04-20 15:29:14 +03:00
parent 27b860682b
commit fa3b3e7a9a
16 changed files with 65 additions and 42 deletions
@@ -1,19 +0,0 @@
//KT-4529 Lambdas are analyzed improperly in an infix call nested inside a println
class G {
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun foo(bar: (Int) -> Int) = bar<!>
}
fun main() {
use(
G().foo {it + 11} // no error
)
use(
G() foo {it + 11} // ERROR
)
use(
G() foo ({it + 1}) // 2 ERRORs
)
}
fun use(a: Any?) = a
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-4529 Lambdas are analyzed improperly in an infix call nested inside a println
class G {
@@ -4,7 +4,7 @@ interface Foo
fun (Foo.() -> Unit).invoke(b : Foo.() -> Unit) {}
object Z {
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun add(b : Foo.() -> Unit) : Z = Z<!>
infix fun add(b : Foo.() -> Unit) : Z = Z
}
val t2 = Z <!INAPPLICABLE_CANDIDATE!>add<!> { } { }