Skip to content

Commit ab84e30

Browse files
committed
Allow Typing_env.mem to consider symbols present even if their cmx is missing
1 parent 34d76ff commit ab84e30

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,17 @@ let mem ?min_name_mode t name =
771771
~symbol:(fun sym ->
772772
(* CR mshinwell: This might not take account of symbols in missing
773773
.cmx files *)
774-
Symbol.Set.mem sym t.defined_symbols
775-
|| Name.Set.mem name (t.get_imported_names ()))
774+
let comp_unit = Symbol.compilation_unit sym in
775+
if Compilation_unit.equal comp_unit (Compilation_unit.get_current_exn ())
776+
then
777+
Symbol.Set.mem sym t.defined_symbols
778+
else
779+
match (resolver t) comp_unit with
780+
| None ->
781+
(* The cmx is unavailable, but the symbol is valid *)
782+
true
783+
| Some _ ->
784+
Name.Set.mem name (t.get_imported_names ()))
776785

777786
let mem_simple ?min_name_mode t simple =
778787
Simple.pattern_match simple

0 commit comments

Comments
 (0)