Why is there an extra parameter added to the lambd...
# compiler
c
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
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
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
Are you referring to the
dump
function? Unfortunately, it also has an additional parameter in its result.
t
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.