Skip to content

Commit b6053c4

Browse files
committed
Move handling of comments into 'expansion_of_module'
1 parent 23d0789 commit b6053c4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/xref2/tools.ml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,14 +1576,10 @@ and expansion_of_module_path :
15761576
in
15771577
expansion_of_module_cached env p' m >>= function
15781578
| Signature sg ->
1579-
let sg' =
1580-
match m.doc with
1581-
| [] -> sg
1582-
| doc -> { sg with doc }
1579+
let sg =
1580+
if strengthen then Strengthen.signature (`Resolved p') sg else sg
15831581
in
1584-
if strengthen then
1585-
Ok (Signature (Strengthen.signature (`Resolved p') sg'))
1586-
else Ok (Signature sg')
1582+
Ok (Signature sg)
15871583
| Functor _ as f -> Ok f)
15881584
| Error _ when Cpath.is_module_forward path -> Error `UnresolvedForwardPath
15891585
| Error e -> Error (`UnresolvedPath (`Module (path, e)))
@@ -1719,7 +1715,16 @@ and expansion_of_module :
17191715
Env.t ->
17201716
Component.Module.t ->
17211717
(expansion, expansion_of_module_error) Result.result =
1722-
fun env m -> expansion_of_module_decl env m.type_
1718+
fun env m ->
1719+
expansion_of_module_decl env m.type_ >>= function
1720+
| Signature sg ->
1721+
let sg =
1722+
(* Override the signature's documentation when the module also has
1723+
a comment attached. *)
1724+
match m.doc with [] -> sg | doc -> { sg with doc }
1725+
in
1726+
Ok (Signature sg)
1727+
| Functor _ as f -> Ok f
17231728

17241729
and expansion_of_module_cached :
17251730
Env.t ->

0 commit comments

Comments
 (0)