openrewrite / rewrite-kotlin

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

Add new `K.TypeAlias` element #550

Closed knutwannheden closed 6 months ago

knutwannheden commented 6 months ago

Type aliases are currently modelled as variable declarations with a special typealias modifier on them. While this works syntactically, it doesn't make much sense from a model perspective, as a typealias doesn't really introduce a new variable and as such would end up confusing a lot of existing recipes. Instead, there should be a dedicated K.TypeAlias model element for this.

knutwannheden commented 6 months ago

Please also see https://github.com/openrewrite/rewrite-kotlin/pull/549/commits/12f31a05ab935d5e95b89c905f60d7333d253f23 where I removed some legacy handling of typealias. It looks like we at some point had a dedicated typealias annotation instead.

traceyyoshima commented 6 months ago

PR is pending a decision on how to represent the whitespace, comments, and annotations before the keyword typealias.