@@ -263,6 +263,11 @@ module Anchor = struct
263263 let page = Path. from_identifier parent in
264264 Ok { page; anchor = str_name; kind }
265265
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+
266271 let rec from_identifier : Identifier.t -> (t, Error.t) result =
267272 let open Error in
268273 function
@@ -362,7 +367,7 @@ module Anchor = struct
362367 | { iv = `Constructor (parent , name ); _ } ->
363368 from_identifier (parent :> Identifier.t ) >> = fun page ->
364369 let kind = `Constructor in
365- let suffix = ConstructorName. to_string name in
370+ let suffix = suffix_for_constructor ( ConstructorName. to_string name) in
366371 Ok (add_suffix ~kind page suffix)
367372 | { iv = `Field (parent , name ); _ } ->
368373 from_identifier (parent :> Identifier.t ) >> = fun page ->
@@ -415,7 +420,7 @@ module Anchor = struct
415420 add_suffix ~kind url suffix
416421 | Constructor { name; _ } ->
417422 let kind = `Constructor in
418- let suffix = name in
423+ let suffix = suffix_for_constructor name in
419424 add_suffix ~kind url suffix)
420425
421426 (* * The anchor looks like
0 commit comments