Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
traceyyoshima opened this issue Dec 21, 2023 · 1 comment
Open

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

traceyyoshima opened this issue Dec 21, 2023 · 1 comment
Labels
bug Something isn't working parser-kotlin

Comments

@traceyyoshima
Copy link
Contributor

              fun f(m: Map<Any, Any>): String {
                  return m.map { ( k, v ): Map.Entry<Any, Any> -> "$k: $v"}.toString()
              }
@traceyyoshima traceyyoshima added bug Something isn't working parser-kotlin labels Dec 21, 2023
@kunli2 kunli2 self-assigned this Jan 2, 2024
@kunli2
Copy link
Contributor

kunli2 commented Jan 2, 2024

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
- 1. J.Lambda.Parameters#parenthesized = true
- 2. J.Lambda.Parameters#parameters (type : List<JRightPadded<J>>) is a list of J.VaraibleDeclarations, has two elements: k : String and v : Int.
However, I didn't find a proper place for Map.Entry<String, Int>.

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

@timtebeek timtebeek moved this to Backlog in OpenRewrite May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-kotlin
Projects
Status: Backlog
Development

No branches or pull requests

2 participants