Skip to content

Commit d3297bb

Browse files
committed
Merge fix
1 parent 5fd201d commit d3297bb

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

middle_end/flambda/types/env/typing_env.rec.ml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -880,30 +880,29 @@ let add_definition t (name : Name_in_binding_pos.t) kind =
880880
end;
881881
add_symbol_definition t sym)
882882

883-
let invariant_for_alias aliases name ty =
883+
let invariant_for_alias (t:t) name ty =
884884
(* Check that no canonical element gets an [Equals] type *)
885885
if !Clflags.flambda_invariant_checks || true then begin
886886
match Type_grammar.get_alias_exn ty with
887887
| exception Not_found -> ()
888888
| alias ->
889889
assert (not (Simple.equal alias (Simple.name name)));
890890
let canonical =
891-
Aliases.get_canonical_ignoring_name_mode aliases name
891+
Aliases.get_canonical_ignoring_name_mode (aliases t) name
892892
in
893893
if Simple.equal canonical (Simple.name name) then
894894
Misc.fatal_errorf
895895
"There is about to be an [Equals] equation on canonical name %a@\nequation: %a@\n@."
896896
Name.print name Type_grammar.print ty
897897
end
898898

899-
let invariant_for_aliases t =
900-
let aliases = aliases t in
899+
let invariant_for_aliases (t:t) =
901900
Name.Map.iter (fun name (ty, _, _) ->
902-
invariant_for_alias aliases name ty
901+
invariant_for_alias t name ty
903902
) (names_to_types t)
904903

905-
let invariant_for_new_equation t aliases name ty =
906-
invariant_for_alias aliases name ty;
904+
let invariant_for_new_equation (t:t) name ty =
905+
invariant_for_alias t name ty;
907906
if !Clflags.flambda_invariant_checks then begin
908907
(* CR mshinwell: This should check that precision is not decreasing. *)
909908
let defined_names =
@@ -925,15 +924,15 @@ let invariant_for_new_equation t aliases name ty =
925924
end
926925
end
927926

928-
let rec add_equation0 t name ty =
927+
let rec add_equation0 (t:t) name ty =
929928
if !Clflags.Flambda.Debug.concrete_types_only_on_canonicals then begin
930929
let is_concrete =
931930
match Type_grammar.get_alias_exn ty with
932931
| exception Not_found -> true
933932
| _ -> false
934933
in
935934
if is_concrete then begin
936-
let canonical = Aliases.get_canonical_ignoring_name_mode aliases name in
935+
let canonical = Aliases.get_canonical_ignoring_name_mode (aliases t) name in
937936
if not (Simple.equal canonical (Simple.name name)) then begin
938937
Misc.fatal_errorf "Trying to add equation giving concrete type on %a \
939938
which is not canonical (its canonical is %a): %a"
@@ -943,7 +942,7 @@ let rec add_equation0 t name ty =
943942
end
944943
end
945944
end;
946-
invariant_for_new_equation t aliases name ty;
945+
invariant_for_new_equation t name ty;
947946
let level =
948947
Typing_env_level.add_or_replace_equation
949948
(One_level.level t.current_level) name ty
@@ -1049,7 +1048,7 @@ and add_equation t name ty =
10491048
let ty =
10501049
Type_grammar.alias_type_of kind canonical_element
10511050
in
1052-
alias_of, t, ty
1051+
alias_of_demoted_element, t, ty
10531052
in
10541053
(* Beware: if we're about to add the equation on a name which is different
10551054
from the one that the caller passed in, then we need to make sure that the
@@ -1077,14 +1076,6 @@ and add_equation t name ty =
10771076
in
10781077
Simple.pattern_match simple ~name ~const:(fun _ -> ty, t)
10791078
in
1080-
let ty =
1081-
match rec_info with
1082-
| None -> ty
1083-
| Some rec_info ->
1084-
match Type_grammar.apply_rec_info ty rec_info with
1085-
| Bottom -> Type_grammar.bottom (Type_grammar.kind ty)
1086-
| Ok ty -> ty
1087-
in
10881079
let [@inline always] name name = add_equation0 t name ty in
10891080
Simple.pattern_match simple ~name ~const:(fun _ -> t)
10901081

0 commit comments

Comments
 (0)