Skip to content

Commit

Permalink
Fix loc on open of exported module
Browse files Browse the repository at this point in the history
  • Loading branch information
tjammer committed Aug 29, 2023
1 parent 7cfc422 commit c13a58f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/typing/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,19 @@ let pop_scope env =
| ({ kind = Smodule _; _ } as hd) :: _ -> hd
| _ -> failwith "Internal Error: Not a module scope in [pop_scope]"

let open_module env loc name =
let scope = env.find_module env loc name |> get_module env |> snd in
let cont = empty_scope (Scont (Hashtbl.create 64)) in
{ env with values = cont :: scope :: env.values }

let fix_scope_loc scope loc =
let kind =
match scope.kind with
| Smodule usage -> Smodule { usage with loc }
| (Stoplevel _ | Sfunc _ | Scont _) as kind -> kind
in
{ scope with kind }

let open_module env loc name =
let scope =
env.find_module env loc name |> get_module env |> snd |> fun scope ->
fix_scope_loc scope loc
in

let cont = empty_scope (Scont (Hashtbl.create 64)) in
{ env with values = cont :: scope :: env.values }

0 comments on commit c13a58f

Please sign in to comment.