@@ -263,6 +263,11 @@ module Anchor = struct
263
263
let page = Path. from_identifier parent in
264
264
Ok { page; anchor = str_name; kind }
265
265
266
+ (* This is needed to ensure that references to polymorphic constructors have
267
+ links that use the right suffix: those resolved references are turned into
268
+ _constructor_ identifiers. *)
269
+ let suffix_for_constructor x = x
270
+
266
271
let rec from_identifier : Identifier.t -> (t, Error.t) result =
267
272
let open Error in
268
273
function
@@ -362,7 +367,7 @@ module Anchor = struct
362
367
| { iv = `Constructor (parent , name ); _ } ->
363
368
from_identifier (parent :> Identifier.t ) >> = fun page ->
364
369
let kind = `Constructor in
365
- let suffix = ConstructorName. to_string name in
370
+ let suffix = suffix_for_constructor ( ConstructorName. to_string name) in
366
371
Ok (add_suffix ~kind page suffix)
367
372
| { iv = `Field (parent , name ); _ } ->
368
373
from_identifier (parent :> Identifier.t ) >> = fun page ->
@@ -415,7 +420,7 @@ module Anchor = struct
415
420
add_suffix ~kind url suffix
416
421
| Constructor { name; _ } ->
417
422
let kind = `Constructor in
418
- let suffix = name in
423
+ let suffix = suffix_for_constructor name in
419
424
add_suffix ~kind url suffix)
420
425
421
426
(* * The anchor looks like
0 commit comments