Why is there an extra parameter added to the lambda after dumping it?
Source code:
Copy code
val foo = { a: Int, b: String -> }
val bar = { a: Int -> }
Result after `dumpKotlinLike`:
Copy code
val foo: Function1<Int>
field = local fun <anonymous>(a: Int, b: String, a: Int): KFunction1<Int> {
return Unit
}
get
val bar: Function1<Int>
field = local fun <anonymous>(a: Int, a: Int): KFunction1<Int> {
return Unit
}
get
Chachako
09/05/2023, 6:58 PM
Furthermore, I have a property like this:
val abc = {}
What is the correct way to add a parameter in the lambda? Can someone guide me 😢? Is it correct to use
expression.function.addValueParameter
in
visitFunctionExpression
?
t
Tóth István Zoltán
09/06/2023, 5:29 AM
It's just a guess but I think it is the dispatch receiver of the anonymous function.
I rarely use dumpKotlinLike, IR dump is much more precise, it would probably answer your question.
c
Chachako
09/06/2023, 5:47 AM
Are you referring to the
dump
function? Unfortunately, it also has an additional parameter in its result.
t
Tóth István Zoltán
09/12/2023, 7:59 AM
Sorry, haven't checked slack for a few days, been on sick leave.
Anyway, yes
dump
.
Can you show it the result of dump? It is more informative that kotlinLike.