openrewrite / rewrite-kotlin

Work-in-progress implementation of Kotlin language support for OpenRewrite.
Apache License 2.0
38 stars 11 forks source link

Idempotent print issue: TypeReference on destruct is lost. #558

Open traceyyoshima opened 6 months ago

traceyyoshima commented 6 months ago
              fun f(m: Map<Any, Any>): String {
                  return m.map { ( k, v ): Map.Entry<Any, Any> -> "$k: $v"}.toString()
              }
kunli2 commented 5 months ago

This is a more generic test case, Seems we don't have a proper LST model for this

fun f(m: Map<String, Int>): String {
    return m.map { ( k : String, v : Int) : Map.Entry<String, Int> -> "$k: $v"}.toString()
}

{ ( k : String, v : Int) : Map.Entry<String, Int> -> "$k: $v"} is a J.Lambda. ( k : String, v : Int) : Map.Entry<String, Int> should be a J.Lambda.Parameters, my understanding is ( k : String, v : Int) can fit into a J.Lambda.Parameters with the following values

@knutwannheden and @traceyyoshima , what do you think about the solution for this?