-
Notifications
You must be signed in to change notification settings - Fork 62
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
#[swift_bridge(already_declared)] fails when wrapping an enum in Optional #283
Comments
Thanks for reporting this. ProblemWe generate a swift-bridge/crates/swift-bridge-ir/src/codegen/generate_rust_tokens/shared_enum.rs Lines 204 to 209 in 53b93f4
swift-bridge/crates/swift-bridge-ir/src/codegen/codegen_tests/transparent_enum_codegen_tests.rs Lines 203 to 208 in 832498a
The SolutionThe module that contains the Here are steps to solve this: Add a new Similar to this but for an Lines 168 to 232 in ecd3b97
Add an integration test for calling a Rust function that returns an Similar to: Lines 24 to 32 in 4fbd30f
swift-bridge/crates/swift-integration-tests/src/enum_attributes/already_declared.rs Lines 35 to 37 in 4fbd30f
Update the codegen to use swift-bridge/crates/swift-bridge-ir/src/bridged_type/shared_enum.rs Lines 55 to 62 in 53b93f4
pub fn ffi_option_name_tokens(&self) -> TokenStream {
let maybe_super = if self.already_declared {
"super::"
} else {
""
};
let name = Ident::new(
&format!("{maybe_super}{}Option_{}", SWIFT_BRIDGE_PREFIX, self.name),
self.name.span(),
);
quote! { #name }
} |
Minimal reproduction:
This fails to compile due to:
The text was updated successfully, but these errors were encountered: