-
Notifications
You must be signed in to change notification settings - Fork 198
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
Switch cases with tuple decomposition values does not translate properly #58
Comments
An easier way to also get a proper translation is to use |
How do you use "with" with enums? (Was there more at the end of what you wrote?)
tor
… On 18 Feb 2019, at 09:36, Angel G. Olloqui ***@***.***> wrote:
An easier way to also get a proper translation is to use with. This will work as long as the tuple variables keep the same definition name:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#58 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AB-irhiJjt-Mbu1ytlQRspuJEVtR49Frks5vOmYmgaJpZM4Q5ZEw>.
|
Yes! sorry, I should provide an example. The same code before, could be instead:
This way, the usage of Note that the |
Ah, sorry, there was an extra post with code I didn’t see in the emails I get when we message in the pull request. Still not sure how the the "with" helps initializing from a raw value.
Or am I missing something? |
No, this issue is about the tuple decomposition. I have created another one with the Enum initialization here: #94 |
This Swift code:
Translates to right now to:
However, the
name
variable in Swift has been decomposed from the tuple, and hence the Kotlin version should prefix its usage with the variable in thewhen
expression. In this case:The text was updated successfully, but these errors were encountered: