Skip to content

Commit c03f352

Browse files
committed
Support for OCaml 5.4
1 parent aa59db5 commit c03f352

File tree

7 files changed

+38
-8
lines changed

7 files changed

+38
-8
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
- "4.14"
2020
- "5.1"
2121
- "5.2"
22-
- "ocaml-base-compiler.5.3.0~beta2"
22+
- "5.3"
23+
- "5.4"
2324

2425
runs-on: ${{ matrix.os }}
2526

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: init
22
init:
3-
opam switch create . 5.3.0 --no-install -y
3+
opam switch create . 5.4.0 --no-install -y
44
opam install . --deps-only -y
55
opam install menhir.20201216 ocamlformat ocaml-lsp-server -y
66

mlx/dune

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22
(name pp)
33
(package mlx)
44
(public_name mlx-pp)
5+
(modules :standard \ mlx_shim)
56
(flags
6-
(:standard -w -9-67 -open Astlib.Ast_501))
7+
(:standard -w -9-67 -open Astlib -open Astlib.Ast_501 -open Mlx_shim))
8+
(libraries ppxlib ocaml-compiler-libs.shadow mlx_shim))
9+
10+
(library
11+
(name mlx_shim)
12+
(package mlx)
13+
(modules mlx_shim)
14+
(flags
15+
(:standard -w -9-67 -open Astlib -open Astlib.Ast_501))
716
(libraries ppxlib ocaml-compiler-libs.shadow))
817

918
(ocamllex lexer)

mlx/jsx_helper.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ let make_loc (startpos, endpos) =
1111
Location.loc_ghost = false;
1212
}
1313

14-
let mkloc txt loc = { Location.txt; loc }
1514
let mkexp ~loc d = Exp.mk ~loc:(make_loc loc) d
1615

1716
let mkjsxexp ~loc:loc' e =
@@ -63,7 +62,7 @@ let make_jsx_element ~raise ~loc:_ ~tag ~end_tag ~props ~children () =
6362
in
6463
let props =
6564
let prop_exp ~loc name =
66-
let id = mkloc (Lident name) (make_loc loc) in
65+
let id = Location.mkloc (Lident name) (make_loc loc) in
6766
mkexp ~loc (Pexp_ident id)
6867
in
6968
List.map

mlx/mlx_shim.ml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Pprintast = struct
2+
include Pprintast
3+
4+
let tyvar = Compiler_pprintast.tyvar
5+
end
6+
7+
module Location = struct
8+
include Location
9+
10+
let mkloc txt loc = { Location.txt; loc }
11+
let mknoloc txt = { Location.txt; loc = Location.none }
12+
end
13+
14+
module Longident = struct
15+
include Longident
16+
17+
let last = function
18+
| Lident s -> s
19+
| Ldot (_, s) -> s
20+
| Lapply (_, _) -> Misc.fatal_error "Longident.last"
21+
end

mlx/pp.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ let () =
2929
match str with
3030
| Ok str ->
3131
let str = Conv.copy_structure str in
32-
if !print_ml then Format.printf "%a@." Pprintast.structure str
32+
if !print_ml then
33+
Format.printf "%a@." Compiler_pprintast.structure str
3334
else
3435
let oc = stdout in
3536
output_string oc

ocamlmerlin_mlx/ocaml/preprocess/jsx_helper.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ let make_loc (startpos, endpos) =
1212
Location.loc_ghost = false;
1313
}
1414

15-
let mkloc txt loc = { Location.txt; loc }
1615
let mkexp ~loc d = Exp.mk ~loc:(make_loc loc) d
1716

1817
let mkjsxexp ~loc:loc' e =
@@ -64,7 +63,7 @@ let make_jsx_element ~raise ~loc:_ ~tag ~end_tag ~props ~children () =
6463
in
6564
let props =
6665
let prop_exp ~loc name =
67-
let id = mkloc (Lident name) (make_loc loc) in
66+
let id = Location.mkloc (Lident name) (make_loc loc) in
6867
mkexp ~loc (Pexp_ident id)
6968
in
7069
List.map

0 commit comments

Comments
 (0)