diff options
author | Son HO | 2024-04-12 19:21:29 +0200 |
---|---|---|
committer | GitHub | 2024-04-12 19:21:29 +0200 |
commit | 67eaff0b90d693c86d9848cbf598e7c86caba4c4 (patch) | |
tree | c3b5975b5880e93a96d412d7aca893eda42ea860 /compiler/Extract.ml | |
parent | 03a175b423c9ccff2160300c4d349978f9b1aeb9 (diff) | |
parent | 43ff0300e97ad275fa9b62e89577c754f12e3aa3 (diff) |
Merge pull request #124 from AeneasVerif/son/lean1
Add more definitions to the Lean library
Diffstat (limited to '')
-rw-r--r-- | compiler/Extract.ml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/Extract.ml b/compiler/Extract.ml index 6eeef772..8efb59fb 100644 --- a/compiler/Extract.ml +++ b/compiler/Extract.ml @@ -2644,14 +2644,19 @@ let extract_trait_impl (ctx : extraction_ctx) (fmt : F.formatter) (* Add a break before *) F.pp_print_break fmt 0 0; (* Print a comment to link the extracted type to its original rust definition *) - (let name = + (let name, generics = if !Config.extract_external_name_patterns && not impl.is_local then - Some impl.llbc_name - else None + let decl_id = impl.impl_trait.trait_decl_id in + let trait_decl = TraitDeclId.Map.find decl_id ctx.trans_trait_decls in + let decl_ref = impl.llbc_impl_trait in + ( Some trait_decl.llbc_name, + Some (trait_decl.llbc_generics, decl_ref.decl_generics) ) + else (None, None) in extract_comment_with_span ctx fmt [ "Trait implementation: [" ^ name_to_string ctx impl.llbc_name ^ "]" ] - name impl.meta.span); + (* TODO: why option option for the generics? Looks like a bug in OCaml!? *) + name ?generics:(Some generics) impl.meta.span); F.pp_print_break fmt 0 0; (* Open two outer boxes for the definition, so that whenever possible it gets printed on |