1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
This is an excerpt from ocamlary, showing an issue resolving hidden modules that
aren't roots.
$ cat test.mli
module CanonicalTest : sig
module Base__List : sig
type 'a t
val id : 'a t -> 'a t
end
module Base__ : sig
module List = Base__List
(** @canonical Test.CanonicalTest.Base.List *)
end
module Base : sig
module List = Base__.List
end
module Base_Tests : sig
module C : module type of Base__.List
open Base__
module L = List
val baz : 'a Base__.List.t -> unit
(** We can't reference [Base__] because it's hidden.
{!List.t} ([List.t]) should resolve. *)
end
end
val test : 'a CanonicalTest.Base__.List.t -> unit
module Enclosing : sig
(** This is going to contain a hidden item *)
(**/**)
module Hidden : sig
module Still_hidden : sig
type t
end
end
(**/**)
end
module NonCanonical : sig
module NotHidden = Enclosing.Hidden.Still_hidden
(** This ought to be expanded *)
type hidden__type = int
val helpful : hidden__type
end
$ ocamlc -c -bin-annot test.mli
$ odoc compile test.cmti
This shouldn't cause any warnings:
$ odoc link test.odoc -I .
File "test.mli", line 25, characters 8-17:
Warning: Failed to resolve reference unresolvedroot(List).t Couldn't find "List"
There should be an expansion on `NotHidden`
$ odoc_print test.odocl -r NonCanonical.NotHidden | jq '.type_.Alias[1]'
{
"Some": {
"Signature": {
"items": [
{
"Type": [
"Ordinary",
{
"id": {
"`Type": [
{
"`Module": [
{
"`Module": [
{
"`Root": [
"None",
"Test"
]
},
"NonCanonical"
]
},
"NotHidden"
]
},
"t"
]
},
"source_loc": "None",
"doc": {
"elements": [],
"warnings_tag": "None"
},
"equation": {
"params": [],
"private_": "false",
"manifest": "None",
"constraints": []
},
"representation": "None"
}
]
}
],
"compiled": "true",
"doc": {
"elements": [],
"warnings_tag": "None"
}
}
}
}
$ odoc_print test.odocl -r NonCanonical.helpful
{
"id": {
"`Value": [
{ "`Module": [ { "`Root": [ "None", "Test" ] }, "NonCanonical" ] },
"helpful"
]
},
"source_loc": "None",
"doc": { "elements": [], "warnings_tag": "None" },
"type_": {
"Constr": [
{
"`Resolved": {
"`Identifier": {
"`Type": [
{
"`Module": [
{ "`Root": [ "None", "Test" ] }, "NonCanonical"
]
},
"hidden__type"
]
}
}
},
[]
]
},
"value": "Abstract"
}
|