ocaml-doc / doc-ock

(DEPRECATED) Documentation generation for OCaml
ISC License
15 stars 5 forks source link

Nested module comment scope differs between before/after decl #38

Open dsheets opened 9 years ago

dsheets commented 9 years ago
type t

(** This module has {{!t}type t}! *)
module M : sig
  type t
end

is scoped to the container but

type t

module M : sig
  (** This module has {{!t}type t}! *)

  type t
end

is scoped to the child, M.

See also dsheets/ocamlary-test-library@f32633993a29a995fa6719c2b4b854bbd5e5f68c.

lpw25 commented 9 years ago

This is an interesting variation on #15. It seems that we would like self-reference to subcomponents to be highest priority but self-reference to the same definition to be lowest priority.

dsheets commented 9 years ago

I think the rules for the second case work ok. As far as I understand them, the path is searched ancestor-ward starting with self.

I don't understand why the first case is different as I thought both resulted in an annotation node on the same signature item (M).

lpw25 commented 9 years ago

I think that the second one is a stand-alone comment within M rather than it's description. I think that only the top-level modules treat the first comment specially. To be honest I can't actually remember whether this is the case, nor whether this is what ocamldoc currently implements, but I think it is probably the right implementation.

dsheets commented 9 years ago

This affects documentation of cmdliner.