8000 Aliases_of_canonical_element.invariant is a light invariant check by lthls · Pull Request #4191 · oxcaml/oxcaml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Aliases_of_canonical_element.invariant is a light invariant check #4191

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

Merged
merged 2 commits into from
Jun 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
8000
Diff view
Diff view
42 changes: 22 additions & 20 deletions middle_end/flambda2/types/env/aliases.ml
8000
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,28 @@ end = struct
}

let invariant { aliases; all } =
(* The elements in [aliases] have disjoint set of keys. *)
let aliases_union : Map_to_canonical.t =
Name_mode.Map.fold
(fun _name_mode map acc ->
Name.Map.union
(fun elt _coercion1 _coercion2 ->
Misc.fatal_errorf
"[Aliases_of_canonical_element.invariant]: element %a appears \
in several modes"
Name.print elt)
map acc)
aliases Name.Map.empty
in
(* [all] is the union of all elements in [aliases] *)
if Name.Map.equal Coercion.equal all aliases_union
then ()
else
Misc.fatal_errorf
"[Aliases_of_canonical_element.invariant]: [aliases] and [all] are not \
consistent"
if Flambda_features.check_invariants ()
then
(* The elements in [aliases] have disjoint set of keys. *)
let aliases_union : Map_to_canonical.t =
Name_mode.Map.fold
(fun _name_mode map acc ->
Name.Map.union
(fun elt _coercion1 _coercion2 ->
Misc.fatal_errorf
"[Aliases_of_canonical_element.invariant]: element %a \
appears in several modes"
Name.print elt)
map acc)
aliases Name.Map.empty
in
(* [all] is the union of all elements in [aliases] *)
if Name.Map.equal Coercion.equal all aliases_union
then ()
else
Misc.fatal_errorf
"[Aliases_of_canonical_element.invariant]: [aliases] and [all] are \
not consistent"

let [@ocamlformat "disable"] print ppf { aliases; all = _; } =
Name_mode.Map.print (Name.Map.print Coercion.print) ppf aliases
Expand Down
Loading
0