Skip to content

Modules resulting from functor applications do not inherit their documentation comments #1394

@agle

Description

@agle

The documentation generated by the following produces a documentation page for module M which contains the function signature for funct but not the documentation text.

Module Libmodule.M

val funct : unit

module F (X : sig end) = struct
  (** doc text: print a message *)
  let funct = print_endline "hello"
end

module M = F (struct end)
ocamlc -g -bin-annot libmodule.ml
odoc compile --pkg odocbug libmodule.cmt
odoc link libmodule.odoc
odoc html-generate -o _html --support-uri odoc.support --theme-uri odoc.support libmodule.odocl

Desired behaviour:

The module M has documentation similar to module F as below:

val funct : unit

doc text: print a message

This would be really helpful when constructing an interface by including several smaller components that each are documented independently. Currently it seems like a module type needs to be defined and applied to the result of the functor application in order to generate documentation for it, for example as done in ocamlgraph.Graph.Pack

I tested with ocaml 5.3 and odoc 3.1; this bundle just contains the above code and script repro.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions