Skip to content
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

Generics exist in generated code even if they are unused #92

Open
snowsignal opened this issue Apr 9, 2023 · 1 comment
Open

Generics exist in generated code even if they are unused #92

snowsignal opened this issue Apr 9, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@snowsignal
Copy link
Contributor

If a type doesn't serialize any generic fields, we shouldn't be applying a generic parameter to the generated code. However, this is currently not the case.

Ideally, these definitions should not generate data classes/type aliases with generics.

#[typeshare]
struct Phantom<A> {
  some_value: u32,
  _phantom_data: PhantomData<A>
}
#[typeshare]
struct UnusedGeneric<A, B, C> {}
@snowsignal snowsignal added the bug Something isn't working label Apr 25, 2023
@Lucretiel Lucretiel self-assigned this Jul 13, 2023
@Lucretiel
Copy link
Contributor

Is there a possibility that the destination type should have these generics? I'm thinking about a hypothetical case like Uuid<Account> vs Uuid<Collection>, where those types would want to have equivalent distinct generics on the output side.

@Lucretiel Lucretiel removed their assignment Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants