diff --git a/src/loader/implementation.ml b/src/loader/implementation.ml index 4660b8d7ee..e58b319d55 100644 --- a/src/loader/implementation.ml +++ b/src/loader/implementation.ml @@ -463,6 +463,11 @@ let of_cmt (source_id : Odoc_model.Paths.Identifier.SourcePage.t) Analysis.structure (env, uid_to_loc) (id :> Odoc_model.Paths.Identifier.Signature.t) [] structure + |> List.rev + (* Information are accumulated in a list. We need to have the + first info first in the list, to assign anchors with increasing + numbers, so that adding some content at the end of a file does + not modify the anchors for existing anchors. *) in let uid_to_loc_map = Shape.Uid.Tbl.to_map uid_to_loc in let uid_to_id : Odoc_model.Paths.Identifier.SourceLocation.t Shape.Uid.Map.t = diff --git a/test/sources/source.t/a.ml b/test/sources/source.t/a.ml index 8e755f3bee..0d672dad50 100644 --- a/test/sources/source.t/a.ml +++ b/test/sources/source.t/a.ml @@ -13,6 +13,7 @@ let segr = Yoyo.Aa let x = 2 let y = x + 1 let z a = if x = 1 || true then x + y else a +let z' a = if x = 1 || true then x + y else a module A = struct end module B = A diff --git a/test/sources/source.t/run.t b/test/sources/source.t/run.t index 1a5f6f21b9..7d7186a80b 100644 --- a/test/sources/source.t/run.t +++ b/test/sources/source.t/run.t @@ -16,6 +16,7 @@ Files containing some values: let x = 2 let y = x + 1 let z a = if x = 1 || true then x + y else a + let z' a = if x = 1 || true then x + y else a module A = struct end module B = A @@ -128,6 +129,10 @@ Source links generated in the documentation:
Source + -- +
+ + Source --
@@ -264,6 +269,7 @@ Ids generated in the source code: id="L58" id="L59" id="L60" + id="L61" id="type-t" id="type-truc" id="val-xazaz" @@ -274,6 +280,8 @@ Ids generated in the source code: id="val-y" id="val-z" id="local_a_2" + id="val-z'" + id="local_a_3" id="module-A" id="module-B" id="module-type-T"