Skip to content

Commit 49dfc47

Browse files
authored
Restore compatibility with OCaml 4.14 (rescript-lang#6926)
1 parent 53d2d82 commit 49dfc47

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

jscomp/ext/dune

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
(wrapped false)
44
(preprocess
55
(action
6-
(run %{bin:cppo} %{env:CPPO_FLAGS=} %{input-file})))
6+
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{env:CPPO_FLAGS=}
7+
%{input-file})))
78
(flags
89
(:standard -w +a-4-42-40-9-48-70))
910
(foreign_stubs

jscomp/ext/js_reserved_map.ml

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525
module STbl = struct
26-
include Hashtbl.Make (String)
26+
#if OCAML_VERSION >= (5, 0, 0)
27+
include Hashtbl.Make (String)
28+
#else
29+
module StringHash : Hashtbl.HashedType with type t = string = struct
30+
type t = string
31+
let equal = String.equal
32+
let hash = Hashtbl.hash (* polymorphic hash function *)
33+
end
34+
include Hashtbl.Make (StringHash)
35+
#endif
2736

2837
let of_array arr =
2938
let tbl = create (Array.length arr) in

0 commit comments

Comments
 (0)