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

Update args on supertraits of supertraits when cloning trait impls #113

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

When cloning implementations of traits from in-crate structs, we
forgot to update the arguments for supertraits of supertraits,
causing methods on that trait to be called against the previous
struct, not the cloned one.

This was ultimately identified downstream in the Java bindings,
fixes lightningdevkit/ldk-garbagecollected#138

When cloning implementations of traits from in-crate structs, we
forgot to update the arguments for supertraits of supertraits,
causing methods on that trait to be called against the previous
struct, not the cloned one.

This was ultimately identified downstream in the Java bindings,
fixes lightningdevkit/ldk-garbagecollected#138
writeln!(w, "\tnew_obj.{}{}.free = None;", pfx, t).unwrap();
let tr = types.crate_types.traits.get(s).unwrap();
let resolver = get_module_type_resolver!(s, types.crate_types);
seek_supertraits(w, &format!("{}.", t), tr, &resolver);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking nit: Would be a bit clearer if we made pfx an Option<&str> and adjusted the format string accordingly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That feels less readable to me - it's more code and not doing anything other than maintaining the prefix (which still can be arbitrarily long). Would you prefer a different variable name instead?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, then feel free to leave as is.

@TheBlueMatt TheBlueMatt merged commit 78310f9 into lightningdevkit:main Oct 9, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partial signer wrapping panics with missing call to provide_channel_parameters
3 participants