Skip to content

Commit

Permalink
Filter out more problematic aliases.
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebuyse committed Feb 3, 2025
1 parent bacca2e commit 72c8a92
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions engine/lib/dependencies.ml
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,26 @@ module Make (F : Features.T) = struct
match origin_item.v with
(* We don't want to aliases for constructors of structs with named fields because
they can't be imported in F*. Ideally this should be handled by the backend. *)
(* We don't need aliases for fields of structs. *)
| Type { variants; is_struct = true; _ }
when List.for_all variants ~f:(fun variant -> variant.is_record)
&& Concrete_ident.is_constructor from_id
||
match List.last (Concrete_ident.to_view from_id).rel_path with
&& Concrete_ident.is_constructor from_id ->
None
(* We don't need aliases for fields of types. *)
| Type _
when match List.last (Concrete_ident.to_view from_id).rel_path with
| Some (`Field _) -> true
| _ -> false ->
None
| Quote _ -> None
(* We don't need aliases for methods of trait impls. *)
| Impl _
when match List.last (Concrete_ident.to_view from_id).rel_path with
| Some (`AssociatedItem _) -> true
| _ -> false ->
None
| Quote _
(* This is temporary: see https://github.com/cryspen/hax/issues/1285 *)
| Trait _ ->
None
| _ -> Some { attrs; span = origin_item.span; ident = from_id; v })
in
let rename =
Expand Down

0 comments on commit 72c8a92

Please sign in to comment.