@@ -807,21 +807,20 @@ let choose_canonical_element_to_be_demoted t ~canonical_element1
807807type add_result = {
808808 t : t ;
809809 canonical_element : Simple .t ;
810- alias_of_demoted_element : Simple .t ;
811- coercion_from_alias_of_demoted_to_canonical : Coercion .t ;
810+ demoted_alias : Simple .t ;
812811}
813812
814- let invariant_add_result ~original_t { canonical_element; alias_of_demoted_element ; t; coercion_from_alias_of_demoted_to_canonical = _ ; } =
813+ let invariant_add_result ~original_t { canonical_element; demoted_alias ; t; } =
815814 if ! Clflags. flambda_invariant_checks then begin
816815 invariant t;
817- if not (Simple. equal canonical_element alias_of_demoted_element ) then begin
816+ if not (Simple. equal canonical_element demoted_alias ) then begin
818817 if not (defined_earlier t canonical_element
819- ~than: alias_of_demoted_element ) then begin
818+ ~than: demoted_alias ) then begin
820819 Misc. fatal_errorf " Canonical element %a should be defined earlier \
821820 than %a after alias addition.@ Original alias tracker:@ %a@ \
822821 Resulting alias tracker:@ %a"
823822 Simple. print canonical_element
824- Simple. print alias_of_demoted_element
823+ Simple. print demoted_alias
825824 print original_t
826825 print t
827826 end
@@ -833,9 +832,9 @@ let add_alias t ~element1 ~coercion_from_element2_to_element1 ~element2 =
833832 ~coercion_from_element1_to_canonical_element1
834833 ~coercion_from_element2_to_canonical_element2
835834 ~coercion_from_canonical_element2_to_canonical_element1 =
836- let canonical_element, to_be_demoted, alias_of_demoted_element ,
837- coercion_from_demoted_to_canonical ,
838- coercion_from_alias_of_demoted_to_demoted =
835+ let canonical_element, demoted_canonical, demoted_alias ,
836+ coercion_from_demoted_canonical_to_canonical ,
837+ coercion_from_demoted_alias_to_demoted_canonical =
839838 let which_element =
840839 choose_canonical_element_to_be_demoted t
841840 ~canonical_element1 ~canonical_element2
@@ -858,19 +857,22 @@ let add_alias t ~element1 ~coercion_from_element2_to_element1 ~element2 =
858857 add_alias_between_canonical_elements
859858 t
860859 ~canonical_element
861- ~coercion_to_canonical: coercion_from_demoted_to_canonical
862- ~to_be_demoted
860+ ~coercion_to_canonical: coercion_from_demoted_canonical_to_canonical
861+ ~to_be_demoted: demoted_canonical
863862 in
864- let coercion_from_alias_of_demoted_to_canonical =
863+ let coercion_from_demoted_alias_to_canonical =
865864 Coercion. compose_exn
866- coercion_from_alias_of_demoted_to_demoted
867- ~then_: coercion_from_demoted_to_canonical
865+ coercion_from_demoted_alias_to_demoted_canonical
866+ ~then_: coercion_from_demoted_canonical_to_canonical
867+ in
868+ let demoted_alias =
869+ Simple. with_coercion demoted_alias
870+ coercion_from_demoted_alias_to_canonical
868871 in
869872 Or_bottom. map t ~f: (fun t ->
870873 { t;
871874 canonical_element;
872- alias_of_demoted_element;
873- coercion_from_alias_of_demoted_to_canonical;
875+ demoted_alias;
874876 })
875877 in
876878 match canonical t element1, canonical t element2 with
0 commit comments