Skip to content

Commit 32c3411

Browse files
Julowjonludlam
authored andcommitted
test: Add RawOptional test case
1 parent cf79b2c commit 32c3411

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

test/xref2/github_issue_1001.t/run.t

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$ ocamlc -c -bin-annot test.ml
22
$ odoc compile test.cmt
33
$ odoc link test.odoc
4-
$ odoc html-generate -o html test.odocl
4+
$ odoc html-generate -o html --indent test.odocl
55
$ odoc support-files -o html
66

77
We should have an 'Optional' argument (as opposed to a 'RawOptional' one)
@@ -26,3 +26,37 @@ We should have an 'Optional' argument (as opposed to a 'RawOptional' one)
2626
},
2727
"value": "Abstract"
2828
}
29+
30+
Harder case contains a "RawOptional":
31+
32+
$ odoc_print -r g test.odocl
33+
{
34+
"id": { "`Value": [ { "`Root": [ "None", "Test" ] }, "g" ] },
35+
"source_loc": "None",
36+
"doc": { "elements": [], "suppress_warnings": "false" },
37+
"type_": {
38+
"Arrow": [
39+
{ "Some": { "RawOptional": "optional" } },
40+
{
41+
"Constr": [
42+
{
43+
"`Resolved": {
44+
"`Identifier": {
45+
"`Type": [ { "`Root": [ "None", "Test" ] }, "hard" ]
46+
}
47+
}
48+
},
49+
[]
50+
]
51+
},
52+
{
53+
"Arrow": [
54+
"None",
55+
{ "Constr": [ { "`Resolved": { "`CoreType": "unit" } }, [] ] },
56+
{ "Var": "a" }
57+
]
58+
}
59+
]
60+
},
61+
"value": "Abstract"
62+
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
type t = int option
2-
let rec f ?(optional : t) () = f ?optional ()
1+
type easy = int option
2+
let rec f ?(optional : easy) () = f ?optional ()
3+
4+
type 'a opt = 'a option
5+
type hard = int opt
6+
let rec g ?(optional : hard) () = g ?optional ()

0 commit comments

Comments
 (0)