@@ -807,21 +807,20 @@ let choose_canonical_element_to_be_demoted t ~canonical_element1
807
807
type add_result = {
808
808
t : t ;
809
809
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 ;
812
811
}
813
812
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; } =
815
814
if ! Clflags. flambda_invariant_checks then begin
816
815
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
818
817
if not (defined_earlier t canonical_element
819
- ~than: alias_of_demoted_element ) then begin
818
+ ~than: demoted_alias ) then begin
820
819
Misc. fatal_errorf " Canonical element %a should be defined earlier \
821
820
than %a after alias addition.@ Original alias tracker:@ %a@ \
822
821
Resulting alias tracker:@ %a"
823
822
Simple. print canonical_element
824
- Simple. print alias_of_demoted_element
823
+ Simple. print demoted_alias
825
824
print original_t
826
825
print t
827
826
end
@@ -833,9 +832,9 @@ let add_alias t ~element1 ~coercion_from_element2_to_element1 ~element2 =
833
832
~coercion_from_element1_to_canonical_element1
834
833
~coercion_from_element2_to_canonical_element2
835
834
~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 =
839
838
let which_element =
840
839
choose_canonical_element_to_be_demoted t
841
840
~canonical_element1 ~canonical_element2
@@ -858,19 +857,22 @@ let add_alias t ~element1 ~coercion_from_element2_to_element1 ~element2 =
858
857
add_alias_between_canonical_elements
859
858
t
860
859
~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
863
862
in
864
- let coercion_from_alias_of_demoted_to_canonical =
863
+ let coercion_from_demoted_alias_to_canonical =
865
864
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
868
871
in
869
872
Or_bottom. map t ~f: (fun t ->
870
873
{ t;
871
874
canonical_element;
872
- alias_of_demoted_element;
873
- coercion_from_alias_of_demoted_to_canonical;
875
+ demoted_alias;
874
876
})
875
877
in
876
878
match canonical t element1, canonical t element2 with
0 commit comments