File tree Expand file tree Collapse file tree 5 files changed +31
-16
lines changed
test/bin/mdx-test/expect/errors Expand file tree Collapse file tree 5 files changed +31
-16
lines changed Original file line number Diff line number Diff line change 22
33#### Added
44
5+ - Make MDX compatible with OCaml 5.1 (#435 , @polytypic and @kit-ty-kate )
6+
57#### Changed
68
79#### Deprecated
Original file line number Diff line number Diff line change @@ -264,3 +264,19 @@ let redirect_directive directive =
264264 | "untrace_all" -> mdx_untrace_all
265265#endif
266266 | v -> v
267+
268+ let rec get_id_in_path = function
269+ | Path. Pident id -> id
270+ | Path. Pdot (p , _ ) -> get_id_in_path p
271+ | Path. Papply (_ , p ) -> get_id_in_path p
272+ #if OCAML_VERSION > = (5 , 1 , 0 )
273+ | Path. Pextra_ty (p , _ ) -> get_id_in_path p
274+ #endif
275+
276+ let get_id_opt = function
277+ | Path. Pident id -> Some id
278+ | Path. Pdot _ -> None
279+ | Path. Papply _ -> None
280+ #if OCAML_VERSION > = (5 , 1 , 0 )
281+ | Path. Pextra_ty _ -> None
282+ #endif
Original file line number Diff line number Diff line change @@ -67,3 +67,5 @@ val execute_phrase :
6767
6868(* If the directive has to be intercepted, this function will return the new name of the directive *)
6969val redirect_directive : string -> string
70+ val get_id_in_path : Path .t -> Ident .t
71+ val get_id_opt : Path .t -> Ident .t option
Original file line number Diff line number Diff line change @@ -214,11 +214,6 @@ module Rewrite = struct
214214 | _ -> path)
215215 | _ -> path
216216
217- let rec get_id_in_path = function
218- | Path. Pident id -> id
219- | Path. Pdot (p , _ ) -> get_id_in_path p
220- | Path. Papply (_ , p ) -> get_id_in_path p
221-
222217 let is_persistent_value env longident =
223218 let is_persistent_path p = Ident. persistent (get_id_in_path p) in
224219 try is_persistent_path (fst (Compat_top. lookup_value longident env))
@@ -701,9 +696,9 @@ let rec save_summary acc s =
701696 ~module_: (fun summary id ~present ->
702697 match present with true -> add summary id | false -> acc)
703698 ~open_: (fun summary x ->
704- match x with
705- | Pident id -> add summary id
706- | Pdot _ | Papply _ -> default_case summary)
699+ match get_id_opt x with
700+ | Some id -> add summary id
701+ | None -> default_case summary)
707702 ~class_: add ~functor_arg: add ~extension: add
708703 ~empty: (fun () -> acc)
709704 ~constraints: default_case ~cltype: default_case ~modtype: default_case
Original file line number Diff line number Diff line change @@ -53,14 +53,6 @@ Error: This expression has type string but an expression was expected of type
5353 int
5454```
5555
56- ``` ocaml version>=4.08
57- # let x =
58- 1 + "42";;
59- Line 2, characters 7-11:
60- Error: This expression has type string but an expression was expected of type
61- int
62- ```
63-
6456``` ocaml non-deterministic=output
6557# raise Not_found;;
6658Exception: Not_found.
@@ -71,3 +63,11 @@ Exception: Not_found.
7163first
7264Exception: Failure "second".
7365```
66+
67+ ``` ocaml version>=4.08
68+ # let x =
69+ 1 + "42";;
70+ Line 2, characters 7-11:
71+ Error: This expression has type string but an expression was expected of type
72+ int
73+ ```
You can’t perform that action at this time.
0 commit comments