Skip to content

Commit c80f0cd

Browse files
authored
Merge pull request #1060 from Julow/compat-402
Compatibility with 4.02
2 parents 2ec4fab + eafb9c8 commit c80f0cd

File tree

16 files changed

+1642
-621
lines changed

16 files changed

+1642
-621
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ jobs:
1010
strategy:
1111
matrix:
1212
os:
13-
- macos-latest
1413
- ubuntu-latest
15-
# - windows-latest Windows doesn't work yet
1614
ocaml-compiler:
17-
# Don't include every versions. OCaml-CI already covers that
15+
- 4.02.x
16+
- 4.04.x
17+
- 4.06.x
18+
- 4.08.x
19+
- 4.10.x
20+
- 4.12.x
1821
- 4.14.x
1922
include:
20-
- os: ubuntu-latest # Enable coverage only on a single build
23+
- os: ubuntu-latest
24+
ocaml-compiler: 4.14.x
25+
# We don't need to compute coverage for more than one build
2126
send-coverage: true
27+
# Mdx tests Mdx tests
28+
run-mdx: true
2229
fail-fast: false
2330

2431
runs-on: ${{ matrix.os }}
@@ -40,21 +47,19 @@ jobs:
4047
- name: Install dependencies
4148
run: opam install -y --deps-only -t ./odoc.opam ./odoc-parser.opam
4249

43-
- name: Install bisect_ppx
44-
run: opam install bisect_ppx
45-
4650
- name: dune runtest
4751
run: opam exec -- dune runtest
4852

49-
# Run Mdx tests that are disabled by default.
5053
- name: Mdx tests
54+
if: matrix.run-mdx == true
5155
run: |
5256
opam install -y mdx
5357
opam exec -- dune build @runmdx
5458
5559
- name: Send coverage stats to Coveralls
5660
if: matrix.send-coverage == true
5761
run: |
62+
opam install bisect_ppx
5863
opam exec -- dune runtest --instrument-with bisect_ppx --force
5964
opam exec -- bisect-ppx-report send-to Coveralls
6065
env:

src/html/config.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
type t
44

55
val v :
6-
?search_result:bool
7-
(** Indicates whether this is a summary for a search result.
8-
In that case, the links will be printed as regular text. *) ->
6+
?search_result:bool ->
97
?theme_uri:Types.uri ->
108
?support_uri:Types.uri ->
119
?search_uris:Types.file_uri list ->
@@ -16,6 +14,8 @@ val v :
1614
as_json:bool ->
1715
unit ->
1816
t
17+
(** [search_result] indicates whether this is a summary for a search result. In
18+
that case, the links will be printed as regular text. *)
1919

2020
val theme_uri : t -> Types.uri
2121

src/html_support_files/dune

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
(rule
55
(aliases runtest support-files)
6-
(enabled_if
7-
(> %{ocaml_version} 4.08))
86
(target odoc_html_support_files.ml)
97
(deps
108
(glob_files *.js)
@@ -29,8 +27,7 @@
2927
-o
3028
odoc_html_support_files.ml
3129
-m
32-
plain
33-
-s))))
30+
plain))))
3431

3532
(library
3633
(name odoc_html_support_files)

src/odoc/bin/main.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ module Indexing = struct
405405
let output = output_file ~dst in
406406
match (inputs_in_file, inputs) with
407407
| [], [] ->
408-
Error
408+
Result.Error
409409
(`Msg
410410
"At least one of --file-list or an .odocl file must be passed to \
411411
odoc compile-index")
@@ -762,8 +762,7 @@ module Odoc_html_args = struct
762762
else Relative (conv_rel_file str))
763763
in
764764
let printer ppf = function
765-
| Odoc_html.Types.((Absolute uri : file_uri)) ->
766-
Format.pp_print_string ppf uri
765+
| Odoc_html.Types.Absolute uri -> Format.pp_print_string ppf uri
767766
| Odoc_html.Types.Relative _uri -> Format.pp_print_string ppf ""
768767
in
769768
(parser, printer)

src/search/html.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let url id =
1414
~indent:false ~flat:false ~open_details:false ~as_json:false ()
1515
in
1616
let url = Odoc_html.Link.href ~config ~resolve:(Base "") url in
17-
Ok url
17+
Result.Ok url
1818
| Error _ as e -> e
1919

2020
let map_option f = function Some x -> Some (f x) | None -> None

src/search/html.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ val of_entry : Entry.t -> html list
66

77
val url :
88
Odoc_model.Paths.Identifier.Any.t ->
9-
(string, Odoc_document.Url.Error.t) result
9+
(string, Odoc_document.Url.Error.t) Result.result
1010

1111
(** The below is intended for search engine that do not use the Json output but
1212
Odoc as a library. Most search engine will use their own representation

src/search/json_index/json_display.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ open Odoc_search
22

33
let of_entry { Entry.id; doc = _; kind = _ } h =
44
match Html.url id with
5-
| Ok url ->
5+
| Result.Ok url ->
66
let html =
77
h
88
|> List.map (fun html ->
99
Format.asprintf "%a" (Tyxml.Html.pp_elt ()) html)
1010
|> String.concat ""
1111
in
12-
Ok (`Object [ ("url", `String url); ("html", `String html) ])
12+
Result.Ok (`Object [ ("url", `String url); ("html", `String html) ])
1313
| Error _ as e -> e

src/search/json_index/json_display.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ open Odoc_search
33
val of_entry :
44
Entry.t ->
55
Html.html list ->
6-
(Odoc_html.Json.json, Odoc_document.Url.Error.t) result
6+
(Odoc_html.Json.json, Odoc_document.Url.Error.t) Result.result

src/search/json_index/json_search.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ let of_entry ({ Entry.id; doc; kind } as entry) html =
168168
]
169169
in
170170
match Json_display.of_entry entry html with
171-
| Ok display ->
172-
Ok
171+
| Result.Ok display ->
172+
Result.Ok
173173
(`Object
174174
[ ("id", j_id); ("doc", doc); ("kind", kind); ("display", display) ])
175175
| Error _ as e -> e

src/xref2/compile.ml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ let type_path : Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
2121
| Ok p' -> `Resolved Lang_of.(Path.resolved_type (empty ()) p')
2222
| Error _ -> p)
2323

24-
and value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t =
25-
fun env p ->
26-
match p with
27-
| `Resolved _ -> p
28-
| _ -> (
29-
let cp = Component.Of_Lang.(value_path (empty ()) p) in
30-
match Tools.resolve_value_path env cp with
31-
| Ok p' -> `Resolved Lang_of.(Path.resolved_value (empty ()) p')
32-
| Error _ -> p)
33-
34-
and constructor_path :
35-
Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t =
36-
fun env p ->
37-
match p with
38-
| `Resolved _ -> p
39-
| _ -> (
40-
let cp = Component.Of_Lang.(constructor_path (empty ()) p) in
41-
match Tools.resolve_constructor_path env cp with
42-
| Ok p' -> `Resolved Lang_of.(Path.resolved_constructor (empty ()) p')
43-
| Error _ -> p)
24+
(* and value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t = *)
25+
(* fun env p -> *)
26+
(* match p with *)
27+
(* | `Resolved _ -> p *)
28+
(* | _ -> ( *)
29+
(* let cp = Component.Of_Lang.(value_path (empty ()) p) in *)
30+
(* match Tools.resolve_value_path env cp with *)
31+
(* | Ok p' -> `Resolved Lang_of.(Path.resolved_value (empty ()) p') *)
32+
(* | Error _ -> p) *)
33+
34+
(* and constructor_path : *)
35+
(* Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t = *)
36+
(* fun env p -> *)
37+
(* match p with *)
38+
(* | `Resolved _ -> p *)
39+
(* | _ -> ( *)
40+
(* let cp = Component.Of_Lang.(constructor_path (empty ()) p) in *)
41+
(* match Tools.resolve_constructor_path env cp with *)
42+
(* | Ok p' -> `Resolved Lang_of.(Path.resolved_constructor (empty ()) p') *)
43+
(* | Error _ -> p) *)
4444

4545
and module_type_path :
4646
Env.t -> Paths.Path.ModuleType.t -> Paths.Path.ModuleType.t =
@@ -74,11 +74,6 @@ and class_type_path : Env.t -> Paths.Path.ClassType.t -> Paths.Path.ClassType.t
7474
| Ok p' -> `Resolved Lang_of.(Path.resolved_class_type (empty ()) p')
7575
| Error _ -> p)
7676

77-
let () =
78-
(* Until those are used *)
79-
ignore value_path;
80-
ignore constructor_path
81-
8277
let rec unit env t =
8378
let open Compilation_unit in
8479
let source_info =

0 commit comments

Comments
 (0)