Skip to content

Commit 0f05c84

Browse files
lthlschambart
authored andcommitted
Skip symbols in Typing_env_level join
1 parent 34869b4 commit 0f05c84

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ let concat (t1 : t) (t2 : t) =
186186
symbol_projections;
187187
}
188188

189-
let join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs =
189+
let join_types ~env_at_fork envs_with_levels =
190190
(* Add all the variables defined by the branches as existentials to the
191191
[env_at_fork].
192192
Any such variable will be given type [Unknown] on a branch where it
@@ -241,17 +241,15 @@ let join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs =
241241
Name.print name
242242
Typing_env.print env_at_fork
243243
end;
244-
let is_lifted_const_symbol =
245-
match Name.must_be_symbol_opt name with
246-
| None -> false
247-
| Some symbol ->
248-
Symbol.Set.mem symbol extra_lifted_consts_in_use_envs
249-
in
250244
(* If [name] is that of a lifted constant symbol generated during one
251245
of the levels, then ignore it. [Simplify_expr] will already have
252246
made its type suitable for [env_at_fork] and inserted it into that
253-
environment. *)
254-
if is_lifted_const_symbol then None
247+
environment.
248+
If [name] is a symbol that is not a lifted constant, then it was
249+
defined before the fork and already has an equation in env_at_fork.
250+
While it is possible that its type could be refined by all of the
251+
branches, it is unlikely. *)
252+
if Name.is_symbol name then None
255253
else
256254
let joined_ty =
257255
match joined_ty, use_ty with
@@ -426,7 +424,7 @@ let join ~env_at_fork envs_with_levels ~params
426424
~extra_lifted_consts_in_use_envs;
427425
(* Calculate the joined types of all the names involved. *)
428426
let joined_types =
429-
join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs
427+
join_types ~env_at_fork envs_with_levels
430428
in
431429
(* Next calculate which equations (describing joined types) to propagate to
432430
the join point. (Recall that the environment at the fork point includes

0 commit comments

Comments
 (0)