Skip to content

Commit 61ed373

Browse files
authored
Merge pull request #829 from ocsigen/ppx-fix
Fix #810: keep hashing the filename
2 parents ae7b6ad + 24a8c46 commit 61ed373

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/ppx/ppx_eliom_utils.ml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let pat_args = function [] -> punit () | [p] -> p | l -> Pat.tuple l
5050
These bits are encoded using an OCaml-compatible variant of Base
5151
64, as the hash is used to generate OCaml identifiers. *)
5252
let file_hash loc =
53-
let s = Filename.basename loc.Location.loc_start.pos_fname in
53+
let s = Digest.string (Filename.basename loc.Location.loc_start.pos_fname) in
5454
let e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_'" in
5555
let o = Bytes.create 6 in
5656
let g p = Char.code s.[p] in
@@ -283,7 +283,7 @@ module Cmo = struct
283283
; ev_kind = Event_after ty
284284
; _ } ->
285285
if pos_cnum' = pos_cnum + 1
286-
then Hashtbl.add events (Filename.basename pos_fname, pos_cnum) ty
286+
then Hashtbl.add events (pos_fname, pos_cnum) ty
287287
| _ -> ())
288288
evl
289289

@@ -472,10 +472,7 @@ module Cmo = struct
472472

473473
let find err loc =
474474
let {Lexing.pos_fname; pos_cnum; _} = loc.Location.loc_start in
475-
try
476-
typ
477-
(Hashtbl.find (Lazy.force events)
478-
(Filename.basename pos_fname, pos_cnum))
475+
try typ (Hashtbl.find (Lazy.force events) (pos_fname, pos_cnum))
479476
with Not_found ->
480477
Typ.extension ~loc @@ Location.Error.to_extension
481478
@@ Location.Error.make ~loc ~sub:[]

0 commit comments

Comments
 (0)