-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add support for Kotlin inline value classes #182
Conversation
writeln!(w, "@JvmInline")?; | ||
writeln!(w, "value class {}{}(", self.prefix, ty.id.renamed)?; | ||
|
||
self.write_element( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this block equivalent to a similar block in the write_struct
code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if the redacted string code can be deduplicated; otherwise this looks great to me |
@@ -15,7 +15,7 @@ pub struct BestHockeyTeams2 { | |||
Lies: String, | |||
} | |||
|
|||
#[typeshare(kotlin = "redacted_to_string")] | |||
#[typeshare(kotlin = "Redacted")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the other languages can also have redacted output. It may be better for this to be parsed as #[typeshare(redacted)]
allowing each language formatter to choose how the redacted type should be implemented.
LGTM |
There are instances where we are using a type alias in Kotlin when we should be using an inline value class. This pull request adds a Kotlin-specific typeshare decorator for generating these inline value classes. Additionally, updated the
redacted_to_string
decorator toRedacted
so there is a consistent naming convention for the language-specific decorators.