FIR resolve: add partial support of extension lambda calls

Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
This commit is contained in:
Mikhail Glukhikh
2019-12-23 15:56:50 +03:00
parent 49e94f1ee3
commit de50f8aef3
65 changed files with 292 additions and 144 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ abstract class Tag(val name : String) : Element() {
val attributes = HashMap<String, String>()
protected fun <T : Element> initTag(tag : T, init : T.() -> Unit) : T {
tag.<!UNRESOLVED_REFERENCE!>init<!>()
tag.init()
children.add(tag)
return tag
}
@@ -143,7 +143,7 @@ class A() : BodyTag("a") {
fun html(init : HTML.() -> Unit) : HTML {
val html = HTML()
html.<!UNRESOLVED_REFERENCE!>init<!>()
html.init()
return html
}
@@ -1,7 +1,7 @@
fun bar(doIt: Int.() -> Int) {
1.<!UNRESOLVED_REFERENCE!>doIt<!>()
1?.<!UNRESOLVED_REFERENCE!>doIt<!>()
1.doIt()
1?.doIt()
val i: Int? = 1
i.<!UNRESOLVED_REFERENCE!>doIt<!>()
i?.<!UNRESOLVED_REFERENCE!>doIt<!>()
i?.doIt()
}
@@ -9,5 +9,5 @@ interface A : (String) -> Unit {}
fun foo(a: @ExtensionFunctionType A) {
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
// Only kotlin.Function{n} type annotated with @Extension should
"".<!UNRESOLVED_REFERENCE!>a<!>()
"".a()
}
@@ -26,7 +26,7 @@ fun <T> fooT2() : (t : T) -> T {
fun main(args : Array<String>) {
args.foo()()
<!INAPPLICABLE_CANDIDATE!>args.foo1()()<!>
<!INAPPLICABLE_CANDIDATE!><!UNRESOLVED_REFERENCE!>a<!>.foo1()()<!>
<!UNRESOLVED_REFERENCE!>a<!>.foo1()()
<!UNRESOLVED_REFERENCE!>a<!>.foo1()(<!UNRESOLVED_REFERENCE!>a<!>)
args.foo1()(1)
@@ -9,7 +9,7 @@ class OverloadTest {
object Literal
inline fun <T : Any> OverloadTest.overload(value: T?, function: OverloadTest.(T) -> Unit) {
if (value == null) foo(Literal) else <!INAPPLICABLE_CANDIDATE!>function<!>(value)
if (value == null) foo(Literal) else function(value)
}
// Overload resolution ambiguity
@@ -29,7 +29,7 @@ class Properties {
fun param(param: Obsolete) { param.use() }
fun funcParamReceiver(param: Obsolete.()->Unit) { Obsolete().<!UNRESOLVED_REFERENCE!>param<!>() }
fun funcParamReceiver(param: Obsolete.()->Unit) { Obsolete().param() }
fun funcParamParam(param: (Obsolete)->Unit) { param(Obsolete()) }
fun funcParamRetVal(param: ()->Obsolete) { param() }
@@ -9,8 +9,8 @@ enum class E {
val foo: Any.() -> Unit = {}
fun f1() = E.FIRST.<!UNRESOLVED_REFERENCE!>foo<!>()
fun f2() = E.FIRST.(<!UNRESOLVED_REFERENCE!>foo<!>)()
fun f3() = E.SECOND.<!UNRESOLVED_REFERENCE!>foo<!>()
fun f4() = E.SECOND.(<!UNRESOLVED_REFERENCE!>foo<!>)()
fun f1() = E.FIRST.foo()
fun f2() = E.FIRST.(foo)()
fun f3() = E.SECOND.foo()
fun f4() = E.SECOND.(foo)()
fun f5() = E.SECOND.A()
@@ -9,8 +9,8 @@ enum class E {
val foo: Any.() -> Unit = {}
fun f1() = E.FIRST.<!UNRESOLVED_REFERENCE!>foo<!>()
fun f2() = E.FIRST.(<!UNRESOLVED_REFERENCE!>foo<!>)()
fun f3() = E.SECOND.<!UNRESOLVED_REFERENCE!>foo<!>()
fun f4() = E.SECOND.(<!UNRESOLVED_REFERENCE!>foo<!>)()
fun f1() = E.FIRST.foo()
fun f2() = E.FIRST.(foo)()
fun f3() = E.SECOND.foo()
fun f4() = E.SECOND.(foo)()
fun f5() = E.SECOND.A()
@@ -3,7 +3,7 @@
package kt1875
fun foo(a : Int?, b : Int.(Int)->Int) = a?.<!UNRESOLVED_REFERENCE!>b<!>(1) //unnecessary safe call warning
fun foo(a : Int?, b : Int.(Int)->Int) = a?.b(1) //unnecessary safe call warning
interface T {
val f : ((i: Int) -> Unit)?
@@ -1,11 +1,11 @@
class A(foo: Int.() -> Unit) {
init {
4.<!UNRESOLVED_REFERENCE!>foo<!>()
4.foo()
}
}
fun test(foo: Int.(String) -> Unit) {
4.<!UNRESOLVED_REFERENCE!>foo<!>("")
4.<!UNRESOLVED_REFERENCE!>foo<!>(p1 = "")
4.<!UNRESOLVED_REFERENCE!>foo<!>(p2 = "")
4.foo("")
4.<!INAPPLICABLE_CANDIDATE!>foo<!>(p1 = "")
4.foo(p2 = "")
}
@@ -4,7 +4,7 @@ package a
import java.util.HashMap
private fun <T> test(value: T, extf: String.(value: T)->Unit) {
"".<!UNRESOLVED_REFERENCE!>extf<!>(value)
"".extf(value)
}
fun main() {
@@ -4,7 +4,7 @@ package kt2514
//+JDK
import java.io.Closeable
fun <T> Thread.use(block: Thread.() -> T): T = <!INAPPLICABLE_CANDIDATE!>block<!>()
fun <T> Thread.use(block: Thread.() -> T): T = block()
fun <T: Closeable, R> T.use(block: (T)-> R) : R = block(this)
@@ -7,7 +7,7 @@ interface Closeable {
class C : Closeable
public inline fun <T: Closeable, R> use(t: T, block: T.(T)-> R) : R {
return t.<!UNRESOLVED_REFERENCE!>block<!>(t)
return t.block(t)
}
fun test() {
@@ -7,7 +7,7 @@ interface Closeable {
class C : Closeable
public inline fun <T: Closeable, R> T.use(block: T.()-> R) : R {
return this.<!UNRESOLVED_REFERENCE!>block<!>()
return this.block()
}
fun test() {
@@ -15,7 +15,7 @@ fun Int.test(f: String.(Int) -> Unit) {
f("", 0)
<!INAPPLICABLE_CANDIDATE!>f<!>("")
with("") {
<!INAPPLICABLE_CANDIDATE!>f<!>(0)
f(0)
<!INAPPLICABLE_CANDIDATE!>f<!>(0.0)
}
}
+4 -4
View File
@@ -5,8 +5,8 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
s.invoke(11)
s invoke 11
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11 <!UNRESOLVED_REFERENCE!>ext<!> 11
11.ext(11)
11 ext 11
}
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
@@ -14,8 +14,8 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(
s.invoke(11)
s invoke 11
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11 <!UNRESOLVED_REFERENCE!>ext<!> 11
11.ext(11)
11 ext 11
}
inline fun Function1<Int, Unit>.inlineExt() {
@@ -6,8 +6,8 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
}
inline fun inlineFunWithInvokeClosure(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
subInline({p: Int -> s(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subNoInline({p: Int -> s(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subInline({p: Int -> s(p)}, { p -> this.ext(p)})
subNoInline({p: Int -> s(p)}, { p -> this.ext(p)})
}
//No inline
@@ -17,8 +17,8 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, noinline e
}
inline fun inlineFunWithInvokeClosureNoinline(noinline s: (p: Int) -> Unit, noinline ext: Int.(p: Int) -> Unit) {
subInline({p: Int -> s(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subNoInline({p: Int -> s(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subInline({p: Int -> s(p)}, { p -> this.ext(p)})
subNoInline({p: Int -> s(p)}, { p -> this.ext(p)})
}
//ext function
@@ -28,8 +28,8 @@ inline fun Function1<Int, Unit>.inlineExt(ext: Int.(p: Int) -> Unit) {
}
inline fun Function1<Int, Unit>.inlineExtWithClosure(ext: Int.(p: Int) -> Unit) {
subInline({p: Int -> this(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subNoInline({p: Int -> this(p)}, { p -> this.<!UNRESOLVED_REFERENCE!>ext<!>(p)})
subInline({p: Int -> this(p)}, { p -> this.ext(p)})
subNoInline({p: Int -> this(p)}, { p -> this.ext(p)})
}
inline fun subInline(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {}
@@ -13,8 +13,8 @@ inline var value: (p: Int) -> String
inline var value2: Int.(p: Int) -> String
get() = {"123" }
set(ext: Int.(p: Int) -> String) {
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11.ext(11)
11.ext(11)
val p = ext
}
+4 -4
View File
@@ -19,8 +19,8 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
s.invoke(11)
s invoke 11
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11 <!UNRESOLVED_REFERENCE!>ext<!> 11
11.ext(11)
11 ext 11
s
ext
@@ -34,8 +34,8 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(
s.invoke(11)
s invoke 11
11.<!UNRESOLVED_REFERENCE!>ext<!>(11)
11 <!UNRESOLVED_REFERENCE!>ext<!> 11
11.ext(11)
11 ext 11
s
ext
+1 -1
View File
@@ -3,7 +3,7 @@
fun string(init: StringBuilder.() -> Unit): String{
val answer = StringBuilder()
answer.<!UNRESOLVED_REFERENCE!>init<!>()
answer.init()
return answer.toString()
}
@@ -16,7 +16,7 @@ fun B.b() {
fun test() {
fun <T> without(f: T.() -> Unit): Unit = (null!!).<!UNRESOLVED_REFERENCE!>f<!>()
fun <T> without(f: T.() -> Unit): Unit = (null!!).f()
without<B>() b@ {
object : A {
override fun foo() {
@@ -1,4 +1,4 @@
// !WITH_NEW_INFERENCE
//KT-13330 AssertionError: Illegal resolved call to variable with invoke
fun foo(exec: (String.() -> Unit)?) = "".<!UNRESOLVED_REFERENCE!>exec<!><caret>() // <caret> is test data tag here
fun foo(exec: (String.() -> Unit)?) = "".<!INAPPLICABLE_CANDIDATE!>exec<!><caret>() // <caret> is test data tag here
@@ -21,7 +21,7 @@ fun test2(f: (String) -> Unit) {
}
fun test3(f: String.(String) -> Unit) {
"".<!UNRESOLVED_REFERENCE!>f<!>("")
"".<!UNRESOLVED_REFERENCE!>f<!>(p0 = "")
"".<!UNRESOLVED_REFERENCE!>f<!>(zzz = "")
"".f("")
"".<!INAPPLICABLE_CANDIDATE!>f<!>(p0 = "")
"".<!INAPPLICABLE_CANDIDATE!>f<!>(zzz = "")
}
@@ -10,5 +10,5 @@ return if (answer == 2) "OK" else "FAIL"
}
fun apply(arg:String, f : String.() -> Int) : Int {
return arg.<!UNRESOLVED_REFERENCE!>f<!>()
return arg.f()
}
@@ -2,15 +2,15 @@
class A {
fun foo() {}
fun bar(f: A.() -> Unit = {}) = <!INAPPLICABLE_CANDIDATE!>f<!>()
fun bar(f: A.() -> Unit = {}) = f()
}
class B {
class D {
init {
A().bar {
this.<!UNRESOLVED_REFERENCE!>foo<!>()
<!UNRESOLVED_REFERENCE!>foo<!>()
this.foo()
foo()
}
}
}
@@ -21,7 +21,7 @@ fun <T> generic_invoker(gen : (String) -> T) : T {
}
infix fun <T> T.with(f : T.() -> Unit) {
<!INAPPLICABLE_CANDIDATE!>f<!>()
f()
}
fun main() {
@@ -14,7 +14,7 @@ interface ChannelPipelineFactory{
class StandardPipelineFactory(val config: ChannelPipeline.()->Unit) : ChannelPipelineFactory {
override fun getPipeline() : ChannelPipeline {
val pipeline = DefaultChannelPipeline()
pipeline.<!UNRESOLVED_REFERENCE!>config<!> ()
pipeline.config ()
return pipeline
}
}
@@ -4,5 +4,5 @@ object O
val foo: O.() -> Unit = null!!
fun test() {
O.<!UNRESOLVED_REFERENCE!>foo<!>()
O.foo()
}
@@ -2,6 +2,6 @@ object X
class Y {
fun f(op: X.() -> Unit) {
X.<!UNRESOLVED_REFERENCE!>op<!>()
X.op()
}
}
@@ -2,7 +2,7 @@
fun foo(a: Any, f: ()->Int) = f()
fun foo(a: Any, f: (Any)->Int) = f(a)
fun foo(i: Int, f: Int.()->Int) = i.<!UNRESOLVED_REFERENCE!>f<!>()
fun foo(i: Int, f: Int.()->Int) = i.f()
fun test1() {
<!AMBIGUITY!>foo<!>(1) { ->
@@ -12,17 +12,17 @@ typealias XBar = Bar
typealias XXBar = XBar
fun Foo.foo(body: Foo.() -> Unit) = <!INAPPLICABLE_CANDIDATE!>body<!>()
fun Foo.xbar(body: XBar.() -> Unit) = Bar().<!UNRESOLVED_REFERENCE!>body<!>()
fun Foo.xxbar(body: XXBar.() -> Unit) = Bar().<!UNRESOLVED_REFERENCE!>body<!>()
fun Foo.foo(body: Foo.() -> Unit) = body()
fun Foo.xbar(body: XBar.() -> Unit) = Bar().body()
fun Foo.xxbar(body: XXBar.() -> Unit) = Bar().body()
fun test() {
Foo().foo {
<!UNRESOLVED_REFERENCE!>xbar<!> {
<!UNRESOLVED_REFERENCE!>foo<!> {}
xbar {
foo {}
}
<!UNRESOLVED_REFERENCE!>xxbar<!> {
<!UNRESOLVED_REFERENCE!>foo<!> {}
xxbar {
foo {}
}
}
}
@@ -12,13 +12,13 @@ class Bar
typealias YBar = ZBar
typealias ZBar = <!OTHER_ERROR!>YBar<!>
fun Foo.foo(body: Foo.() -> Unit) = <!INAPPLICABLE_CANDIDATE!>body<!>()
fun Foo.zbar(body: ZBar.() -> Unit) = Bar().<!UNRESOLVED_REFERENCE!>body<!>()
fun Foo.foo(body: Foo.() -> Unit) = body()
fun Foo.zbar(body: ZBar.() -> Unit) = Bar().body()
fun test() {
Foo().foo {
<!UNRESOLVED_REFERENCE!>zbar<!> {
<!UNRESOLVED_REFERENCE!>foo<!> {}
zbar {
foo {}
}
}
}
@@ -20,14 +20,14 @@ package test
import a.A
fun <T, R> T.with(f: T.() -> R) = <!INAPPLICABLE_CANDIDATE!>f<!>()
fun <T, R> T.with(f: T.() -> R) = f()
fun A.extFun1() = b.length
// fun A.extFun2() = c.length // TODO fix KT-9953
val x1 = A("").with { b.<!UNRESOLVED_REFERENCE!>length<!> }
val x1 = A("").with { b.length }
// val x2 = A("").with { c.length } // TODO fix KT-9953
val x3 = A.with { c.<!UNRESOLVED_REFERENCE!>length<!> }
val x3 = A.with { c.length }
@@ -24,10 +24,10 @@ fun test(c: () -> String, e: Int.() -> String) {
c()
(c)()
3.<!UNRESOLVED_REFERENCE!>e<!>()
3.(<!UNRESOLVED_REFERENCE!>e<!>)()
3.e()
3.(e)()
with(3) {
<!INAPPLICABLE_CANDIDATE!>e<!>()
(<!INAPPLICABLE_CANDIDATE!>e<!>)()
e()
(e)()
}
}
@@ -15,8 +15,8 @@ fun test(a: A) {
a.<!INAPPLICABLE_CANDIDATE!>x<!>()
<!INAPPLICABLE_CANDIDATE!>(a.x)()<!>
if (a.x != null) {
a.<!INAPPLICABLE_CANDIDATE!>x<!>() // todo
<!INAPPLICABLE_CANDIDATE!>(a.x)()<!>
a.x() // todo
(a.x)()
}
}
}
@@ -8,5 +8,5 @@ fun test(a: A, foo: Foo) {
}
fun test(a: Int, foo: Int.()->Unit) {
a.<!UNRESOLVED_REFERENCE!>foo<!>()
a.foo()
}
@@ -55,21 +55,21 @@ fun test(a: A, b: B) {
a.foo(b)
with(a) {
b.<!UNRESOLVED_REFERENCE!>foo<!>()
b.foo()
b.(<!UNRESOLVED_REFERENCE!>foo<!>)()
b.(foo)()
<!UNRESOLVED_REFERENCE!>(b.<!UNRESOLVED_REFERENCE!>foo<!>)()<!>
(b.foo)()
foo(b)
(foo)(b)
}
with(b) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
a.(<!INAPPLICABLE_CANDIDATE!>foo<!>)()
a.foo()
a.(foo)()
<!INAPPLICABLE_CANDIDATE!>(a.foo)()<!>
(a.foo)()
(a.foo)(this)
a.foo(this)
@@ -77,8 +77,8 @@ fun test(a: A, b: B) {
with(a) {
with(b) {
<!INAPPLICABLE_CANDIDATE!>foo<!>()
(<!INAPPLICABLE_CANDIDATE!>foo<!>)()
foo()
(foo)()
}
}
}
@@ -6,11 +6,11 @@ class B
fun test(a: A, b: B) {
with(b) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // here must be error, because a is not extension receiver
a.foo() // here must be error, because a is not extension receiver
a.foo(this)
<!INAPPLICABLE_CANDIDATE!>(a.foo)()<!>
(a.foo)()
(a.foo)(this)
}
@@ -1,9 +1,9 @@
interface A
fun foo(invoke: A.()->Unit, a: A) {
a.<!UNRESOLVED_REFERENCE!>invoke<!>()
a.invoke()
}
fun bar(invoke: Any.()->Any, a: Any) {
a.<!UNRESOLVED_REFERENCE!>invoke<!>()
a.invoke()
}
@@ -12,7 +12,7 @@ fun test(a: A, b: B) {
b.(a)()
with(b) {
val y: Int = <!UNRESOLVED_REFERENCE!>a<!>()
(<!UNRESOLVED_REFERENCE!>a<!>)()
val y: Int = a()
(a)()
}
}
@@ -9,7 +9,7 @@ class B {
fun test(foo: A.() -> Int) {
with(A()) {
<!INAPPLICABLE_CANDIDATE!>foo<!>() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><Int>() }
foo() checkType { _<Int>() }
with(B()) {
foo() checkType { _<B>() }
this.foo() checkType { _<B>() }
+1 -1
View File
@@ -1,7 +1,7 @@
// !WITH_NEW_INFERENCE
fun f(s: String, action: (String.() -> Unit)?) {
s.foo().bar().<!UNRESOLVED_REFERENCE!>action<!>()
s.foo().bar().<!INAPPLICABLE_CANDIDATE!>action<!>()
}
fun String.foo() = ""
@@ -7,9 +7,10 @@ FILE fqName:<root> fileName:/extFunInvokeAsFun.kt
CALL 'public abstract fun invoke (p1: kotlin.Any?): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
$this: GET_VAR 'block: kotlin.Function1<kotlin.Any?, kotlin.Unit> declared in <root>.with1' type=kotlin.Function1<kotlin.Any?, kotlin.Unit> origin=null
p1: GET_VAR 'receiver: kotlin.Any? declared in <root>.with1' type=kotlin.Any? origin=null
FUN name:with2 visibility:public modality:FINAL <> (receiver:kotlin.Any?, block:kotlin.Function1<kotlin.Any?, kotlin.Unit>) returnType:IrErrorType
FUN name:with2 visibility:public modality:FINAL <> (receiver:kotlin.Any?, block:kotlin.Function1<kotlin.Any?, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:receiver index:0 type:kotlin.Any?
VALUE_PARAMETER name:block index:1 type:kotlin.Function1<kotlin.Any?, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun with2 (receiver: kotlin.Any?, block: kotlin.Function1<kotlin.Any?, kotlin.Unit>): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: block>#' type=IrErrorType
RETURN type=kotlin.Nothing from='public final fun with2 (receiver: kotlin.Any?, block: kotlin.Function1<kotlin.Any?, kotlin.Unit>): kotlin.Unit declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Any?): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
$this: GET_VAR 'block: kotlin.Function1<kotlin.Any?, kotlin.Unit> declared in <root>.with2' type=kotlin.Function1<kotlin.Any?, kotlin.Unit> origin=null
@@ -1,9 +1,10 @@
FILE fqName:<root> fileName:/extFunSafeInvoke.kt
FUN name:test visibility:public modality:FINAL <> (receiver:kotlin.Any?, fn:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>) returnType:IrErrorType
FUN name:test visibility:public modality:FINAL <> (receiver:kotlin.Any?, fn:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>) returnType:kotlin.Unit?
VALUE_PARAMETER name:receiver index:0 type:kotlin.Any?
VALUE_PARAMETER name:fn index:1 type:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (receiver: kotlin.Any?, fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: fn>#' type=IrErrorType
CONST Int type=kotlin.Int value=42
CONST String type=kotlin.String value="Hello"
RETURN type=kotlin.Nothing from='public final fun test (receiver: kotlin.Any?, fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>): kotlin.Unit? declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Any, p2: kotlin.Int, p3: kotlin.String): kotlin.Unit [operator] declared in kotlin.Function3' type=kotlin.Unit? origin=null
$this: GET_VAR 'fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit> declared in <root>.test' type=kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit> origin=null
p1: CONST Int type=kotlin.Int value=42
p2: CONST String type=kotlin.String value="Hello"
@@ -13,11 +13,12 @@ FILE fqName:<root> fileName:/variableAsFunctionCall.kt
RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>'
CALL 'public abstract fun invoke (): kotlin.Unit [operator] declared in kotlin.Function0' type=kotlin.Unit origin=null
$this: GET_VAR 'f: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test2 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Unit>) returnType:IrErrorType
FUN name:test2 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (f: kotlin.Function1<kotlin.String, kotlin.Unit>): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: f>#' type=IrErrorType
RETURN type=kotlin.Nothing from='public final fun test2 (f: kotlin.Function1<kotlin.String, kotlin.Unit>): kotlin.Unit declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.String): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
$this: GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test2' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.String declared in <root>'