Skip to content

Commit c1d7fc7

Browse files
authored
Merge pull request #17 from OlivierNicole/fix
Fix crash when using lifted module that contains macros
2 parents 05372c7 + 0e551c7 commit c1d7fc7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

typing/env.ml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1518,18 +1518,19 @@ let advance_pos item pos_stat pos_rt env =
15181518
let add sf sf' =
15191519
match (sf, sf') with
15201520
| (Nonstatic, sf) | (sf, Nonstatic) -> sf
1521-
| _ -> assert false
1521+
| (Static, Static) ->
1522+
raise (Invalid_argument "Evaluating static sigitem in phase-1 env")
15221523
in
15231524
let pos = function Static -> pos_stat | Nonstatic -> pos_rt in
15241525
match item with
15251526
| Sig_value (_id, sf, decl) ->
1526-
let sf = add (sf_of_phase (cur_phase env)) sf in
15271527
begin match decl.val_kind with
15281528
| Val_macro ->
15291529
(Biphase (pos_stat, pos_rt), pos_stat+1, pos_rt+1)
15301530
| Val_prim _ ->
1531+
let sf = add (sf_of_phase (cur_phase env)) sf in
15311532
(Uniphase (sf, pos sf), pos_stat, pos_rt)
1532-
| _ when sf = Static ->
1533+
| _ when cur_phase env = 1 || sf = Static ->
15331534
(Uniphase (Static, pos_stat), pos_stat+1, pos_rt)
15341535
| _ ->
15351536
(Uniphase (Nonstatic, pos_rt), pos_stat, pos_rt+1)

0 commit comments

Comments
 (0)