]> git.bitcoin.ninja Git - ldk-java/commitdiff
[C#] Add missing handling of traits with supertraits of supertraits
authorMatt Corallo <git@bluematt.me>
Tue, 5 Sep 2023 00:13:34 +0000 (00:13 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 5 Sep 2023 00:13:34 +0000 (00:13 +0000)
In 831ad69f1f65d26c224fe18003f1694806effa5a support was added for
handling traits with supertraits of supertraits, but the full patch
was not applied to the C# bindings, which is finished here.

csharp_strings.py

index 5361302be675bc3268437769b18c0f48a584b9c5..6f0170817bb6d1e737529237b4510f7730263e5c 100644 (file)
@@ -703,17 +703,21 @@ namespace org { namespace ldk { namespace structs {
                 java_trait_constr = java_trait_constr + ", " + var.arg_name
             else:
                 java_trait_constr += ", " + var[1] + ".new_impl(" + var[1] + "_impl"
+                suptrait_constr = ""
                 for suparg in var[2]:
                     if isinstance(suparg, ConvInfo):
-                        java_trait_constr += ", " + suparg.arg_name
+                        suptrait_constr += ", " + suparg.arg_name
                     else:
-                        java_trait_constr += ", " + suparg[1]
-                java_trait_constr += ").bindings_instance"
+                        suptrait_constr += ", " + suparg[1] + "_impl"
+                java_trait_constr += suptrait_constr + ").bindings_instance"
                 for suparg in var[2]:
                     if isinstance(suparg, ConvInfo):
                         java_trait_constr += ", " + suparg.arg_name
                     else:
-                        java_trait_constr += ", " + suparg[1]
+                        java_trait_constr += ", " + suparg[1] + ".new_impl("
+                        # Blindly assume that we can just strip the first arg to build the args for the supertrait
+                        java_trait_constr += suptrait_constr.split(", ", 1)[1]
+                        java_trait_constr += ").bindings_instance"
         out_java_trait += "\t}\n" + java_trait_wrapper + "\n"
         out_java_trait += java_trait_constr + ");\n\t\treturn impl_holder.held;\n\t}\n"