Skip to content

Commit ec58e8a

Browse files
committed
Skip symbols in Typing_env_level join
1 parent db43402 commit ec58e8a

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
@@ -277,7 +277,7 @@ let concat (t1 : t) (t2 : t) =
277277
symbol_projections;
278278
}
279279

280-
let join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs =
280+
let join_types ~env_at_fork envs_with_levels =
281281
(* Add all the variables defined by the branches as existentials to the
282282
[env_at_fork].
283283
Any such variable will be given type [Unknown] on a branch where it
@@ -332,17 +332,15 @@ let join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs =
332332
Name.print name
333333
Typing_env.print env_at_fork
334334
end;
335-
let is_lifted_const_symbol =
336-
match Name.must_be_symbol_opt name with
337-
| None -> false
338-
| Some symbol ->
339-
Symbol.Set.mem symbol extra_lifted_consts_in_use_envs
340-
in
341335
(* If [name] is that of a lifted constant symbol generated during one
342336
of the levels, then ignore it. [Simplify_expr] will already have
343337
made its type suitable for [env_at_fork] and inserted it into that
344-
environment. *)
345-
if is_lifted_const_symbol then None
338+
environment.
339+
If [name] is a symbol that is not a lifted constant, then it was
340+
defined before the fork and already has an equation in env_at_fork.
341+
While it is possible that its type could be refined by all of the
342+
branches, it is unlikely. *)
343+
if Name.is_symbol name then None
346344
else
347345
let joined_ty =
348346
match joined_ty, use_ty with
@@ -517,7 +515,7 @@ let join ~env_at_fork envs_with_levels ~params
517515
~extra_lifted_consts_in_use_envs;
518516
(* Calculate the joined types of all the names involved. *)
519517
let joined_types =
520-
join_types ~env_at_fork envs_with_levels ~extra_lifted_consts_in_use_envs
518+
join_types ~env_at_fork envs_with_levels
521519
in
522520
(* Next calculate which equations (describing joined types) to propagate to
523521
the join point. (Recall that the environment at the fork point includes

0 commit comments

Comments
 (0)