You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a custom error has a field named message, the generating Kotlin code gives a compilation error.
This error arises due to a naming conflict between the custom field named message in Rust and the message property that is inherited from Kotlin's Exception class.
Steps to Reproduce:
Define a Error that includes a variant with an optional message field, like so:
Hello,
When a custom error has a field named message, the generating Kotlin code gives a compilation error.
This error arises due to a naming conflict between the custom field named message in Rust and the message property that is inherited from Kotlin's Exception class.
Steps to Reproduce:
Implement the necessary traits (
fmt::Display
andstd::error::Error
) for the enum.Generate the Kotlin bindings
Review the generated Kotlin code and observe the attempted override of the message property, leading to the compilation error.
Expected Behavior:
The generated Kotlin code should handle property naming conflicts gracefully, avoiding any compilation errors due to such conflicts 🤞
Actual Behavior:
The Kotlin compiler reports a conflict:
The generated code looks like this:
Workaround:
Of course renaming the message field for the
uniffi::Error
variant to another name (e.g.,errorMessage
) resolves the compilation issue:😇
The text was updated successfully, but these errors were encountered: