Skip to content

Commit 6bd0fc3

Browse files
panglesdjonludlam
authored andcommitted
Use compiler-independent anchor for functor argument
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 853b4d7 commit 6bd0fc3

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

src/loader/implementation.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,11 @@ let of_cmt (source_id_opt : Odoc_model.Paths.Identifier.SourcePage.t option)
441441
| None -> (
442442
match uid with
443443
| Compilation_unit _ -> None
444-
| Item { id; _ } ->
444+
| Item _ ->
445445
let name =
446446
Odoc_model.Names.DefName.make_std
447-
(Printf.sprintf "def_%d" id)
447+
(Printf.sprintf "def_%d_%d" loc.loc_start.pos_cnum
448+
loc.loc_end.pos_cnum)
448449
in
449450
Some name
450451
| _ -> None)

test/sources/source.t/a.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@ end
3131

3232
type a1 = int
3333
and a2 = a1
34+
35+
module F (M : sig
36+
type t
37+
end) =
38+
struct end
39+
40+
module FM = F (struct
41+
type t = int
42+
end)

test/sources/source.t/run.t

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ Files containing some values:
3434

3535
type a1 = int
3636
and a2 = a1
37+
38+
module F (M : sig
39+
type t
40+
end) =
41+
struct end
42+
43+
module FM = F (struct
44+
type t = int
45+
end)
3746

3847
Source pages require a parent:
3948

@@ -140,11 +149,19 @@ Source links generated in the documentation:
140149
--
141150
<div class="spec type anchored" id="type-a1">
142151
<a href="#type-a1" class="anchor"></a>
143-
<a href="../root/source/a.ml.html#def_24" class="source_link">Source</a>
152+
<a href="../root/source/a.ml.html#type-a1" class="source_link">Source
144153
--
145154
<div class="spec type anchored" id="type-a2">
146155
<a href="#type-a2" class="anchor"></a>
147-
<a href="../root/source/a.ml.html#def_25" class="source_link">Source</a>
156+
<a href="../root/source/a.ml.html#type-a2" class="source_link">Source
157+
--
158+
<div class="spec module anchored" id="module-F">
159+
<a href="#module-F" class="anchor"></a>
160+
<a href="../root/source/a.ml.html#module-F" class="source_link">Source
161+
--
162+
<div class="spec module anchored" id="module-FM">
163+
<a href="#module-FM" class="anchor"></a>
164+
<a href="../root/source/a.ml.html#module-FM" class="source_link">Source
148165

149166
Ids generated in the source code:
150167

@@ -182,6 +199,15 @@ Ids generated in the source code:
182199
id="L31"
183200
id="L32"
184201
id="L33"
202+
id="L34"
203+
id="L35"
204+
id="L36"
205+
id="L37"
206+
id="L38"
207+
id="L39"
208+
id="L40"
209+
id="L41"
210+
id="L42"
185211
id="type-t"
186212
id="type-truc"
187213
id="value-{x}2"
@@ -203,5 +229,9 @@ Ids generated in the source code:
203229
id="module-X"
204230
id="module-X.type-t"
205231
id="module-X.type-t"
206-
id="def_24"
207-
id="def_25"
232+
id="type-a1"
233+
id="type-a2"
234+
id="module-F"
235+
id="def_430_436"
236+
id="module-FM"
237+
id="def_480_492"

0 commit comments

Comments
 (0)