Skip to content

Commit

Permalink
Add default case for disambiguation.
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebuyse committed Jan 30, 2025
1 parent 3d2cbc0 commit df2d111
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions engine/lib/concrete_ident/concrete_ident.ml
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ module MakeToString (R : VIEW_RENDERER) = struct
methods which may be repeated (with their implementations),
and for fields (which are repeated by accessors). *)
then
let path : View.ModPath.t = (View.of_def_id i.def_id).mod_path in
let path = List.map ~f:R.render_module path in
let mod_path : View.ModPath.t =
(View.of_def_id i.def_id).mod_path
in
let path = List.map ~f:R.render_module mod_path in
(* Generates the list of all prefixes of reversed `path` *)
List.folding_map ~init:[] (List.rev path) ~f:(fun acc chunk ->
let acc = chunk :: acc in
Expand All @@ -284,7 +286,9 @@ module MakeToString (R : VIEW_RENDERER) = struct
path (* This might shadow, we should escape *))
(* Find the shortest name that doesn't exist already *)
|> List.find ~f:(Hash_set.mem name_set >> not)
|> Option.value_exn
|> Option.value
~default:
(name ^ (View.ModPath.hash mod_path |> Int.to_string))
else name
in
(* Update the maps and hashtables *)
Expand Down

0 comments on commit df2d111

Please sign in to comment.