[FIR] Fix 1.(fun Int.() = 1)() call fir conversion

This commit is contained in:
Ivan Kochurkin
2021-11-23 22:47:36 +03:00
committed by Space
parent 2fd8119a10
commit 9f8387c76a
11 changed files with 45 additions and 31 deletions
@@ -58,15 +58,15 @@ fun main(args : Array<String>) {
fun f() : Int.() -> Unit = {}
fun main1() {
1.(<!FUNCTION_EXPECTED!>fun Int.() = 1<!>)();
1.(fun Int.() = 1)();
{1}();
(fun (x : Int) = x)(1)
1.(<!FUNCTION_EXPECTED!>fun Int.(x : Int) = x<!>)(1);
1.(fun Int.(x : Int) = x)(1);
l@{1}()
1.((<!FUNCTION_EXPECTED!>fun Int.() = 1<!>))()
1.(<!FUNCTION_EXPECTED!>f()<!>)()
1.<!FUNCTION_EXPECTED!>if(true){f()}else{f()}<!>()
1.<!FUNCTION_EXPECTED!>if(true)(fun Int.() {})else{f()}<!>()
1.((fun Int.() = 1))()
1.(f())()
1.if(true){f()}else{f()}()
1.if(true)(fun Int.() {})else{f()}()
1.<!FUNCTION_EXPECTED!>"sdf"<!>()
@@ -78,9 +78,9 @@ fun main1() {
fun test() {
{x : Int -> 1}(<!NO_VALUE_FOR_PARAMETER!>)<!>;
(fun Int.() = 1)(<!NO_VALUE_FOR_PARAMETER!>)<!>
"sd".(<!FUNCTION_EXPECTED!>fun Int.() = 1<!>)()
<!ARGUMENT_TYPE_MISMATCH!>"sd"<!>.(fun Int.() = 1)()
val i : Int? = null
i.(<!UNRESOLVED_REFERENCE!>fun Int.() = 1<!>)();
<!ARGUMENT_TYPE_MISMATCH!>i<!>.(fun Int.() = 1)();
<!INAPPLICABLE_CANDIDATE!>{}<!><Int>()
<!SAFE_CALL_WILL_CHANGE_NULLABILITY!>1<!UNNECESSARY_SAFE_CALL!>?.<!>(<!UNRESOLVED_REFERENCE!>fun Int.() = 1<!>)()<!>
1.<!NO_RECEIVER_ALLOWED!>{}<!>()
@@ -34,7 +34,7 @@ fun test4() {
// should be an error on receiver, shouldn't be thrown away
fun test5() {
1.(<!FUNCTION_EXPECTED!>fun String.()=1<!>)()
<!ARGUMENT_TYPE_MISMATCH!>1<!>.(fun String.()=1)()
}
fun <R: Any> R?.sure() : R = this!!
@@ -1,7 +1,7 @@
fun test1() {
1. (<!FUNCTION_EXPECTED!>fun String.(i: Int) = i<!> )(1)
1.(<!FUNCTION_EXPECTED!>label@ fun String.(i: Int) = i<!> )(1)
<!ARGUMENT_TYPE_MISMATCH!>1<!>. (fun String.(i: Int) = i )(1)
<!ARGUMENT_TYPE_MISMATCH!>1<!>.(label@ fun String.(i: Int) = i )(1)
}
fun test2(f: String.(Int) -> Unit) {
@@ -12,5 +12,5 @@ fun test2(f: String.(Int) -> Unit) {
fun test3() {
fun foo(): String.(Int) -> Unit = {}
1.(<!FUNCTION_EXPECTED!>foo()<!>)(1)
<!ARGUMENT_TYPE_MISMATCH!>1<!>.(foo())(1)
}
@@ -2,11 +2,11 @@ class A(val x: (String.() -> Unit)?)
fun test(a: A) {
if (a.x != null) {
"".(<!FUNCTION_EXPECTED!>a.x<!>)()
"".(a.x)()
a.x("") // todo
(a.x)("")
}
"".(<!FUNCTION_EXPECTED!>a.x<!>)()
"".<!UNSAFE_IMPLICIT_INVOKE_CALL!>(a.x)<!>()
a.<!UNSAFE_IMPLICIT_INVOKE_CALL!>x<!>("")
<!UNSAFE_IMPLICIT_INVOKE_CALL!>(a.x)<!>("")
@@ -7,7 +7,7 @@ class B
val A.foo: B.() -> Unit get() = {}
fun test(a: A, b: B) {
b.(<!UNRESOLVED_REFERENCE!>a.foo<!>)()
b.(a.foo)()
(a.foo)(b)
a.foo(b)
@@ -49,7 +49,7 @@ class A {
class B
fun test(a: A, b: B) {
b.(<!UNRESOLVED_REFERENCE!>a.foo<!>)()
b.(a.foo)()
(a.foo)(b)
a.foo(b)