-
Notifications
You must be signed in to change notification settings - Fork 232
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
Issue using only a few types from a uniffi dependency in a uniffi library #2282
Comments
This does seem like a bug, but I can't repro it. eg, in our repo and the following patch:
This is your "low level" crate. I run the command
(which is your "main" crate, the crate we are testing) it does. |
I wonder if it's because you are using the proc macros? I made a smaller reproducible example here: uniffi/2282. My I only realized this because one of our types was defined at both layers (but the higher-level library did not import the low-level one) and that created issues for Swift because in Swift all imports are imported at once and therefore we were getting a name clash. |
I don't think procmacros would make a difference here, but both those crates I mentioned above do have udl files. |
Hi there. I maintain a uniffi-based library which we have recently broken into two (I'll call them
main
andlow-level-types
). Our main library imports some of the types defined in this lower-level library we maintain to offer those lower-level types to other libraries that use uniffi.I recently found an issue where types defined in my main library that are also defined in the lowe-level-types dependency name clash in Swift because Swift imports all types at once. This lead me to look into the glue code generated for the lower-level dependency, and notice that all types in that library are added to the glue code even though our library only imports some of them.
I'm wondering if I am maybe not configuring the dependency correctly, or if there is something I misunderstood.
Here is an example udl from the lower-level-types library:
And our use of the Script type in the main library:
[ExternalInterface="core_types_ffi"] typedef extern Script;
Again our issue is that the
OutPoint
type will appear in the glue code for the lower-level-types even though we do not need it there. Moreover, because we do have anOutPoint
type in themain
library, the twoOutpoint
s will clash and runtime tests/code will fail.The text was updated successfully, but these errors were encountered: