ocaml-doc / doc-ock

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

Fragment.path should use a Path.module_type for base? #10

Closed dsheets closed 10 years ago

dsheets commented 10 years ago
val path: 'a Path.module_ -> 'b t -> ('a, 'b) Path.t

but

and ModuleType : sig
type 'a substitution =
| ModuleEq of Fragment.module_ * 'a Module.Equation.t
| TypeEq of Fragment.type_ * 'a TypeDecl.Equation.t
| ModuleSubst of Fragment.module_ * 'a Path.module_
| TypeSubst of Fragment.type_ * 'a TypeExpr.t

and

module Package : sig
type 'a substitution = Fragment.type_ * 'a TypeExpr.t
type 'a t =
{ path: 'a Path.module_type;
substitutions: 'a substitution list; }
lpw25 commented 10 years ago

This is a bug, I changed Fragment.Resolved.identifier to be signature but forgot to change Fragment.Resolved.path and Fragment.path the same way. I'll fix it shortly.

lpw25 commented 10 years ago

Actually, its not a bug it is the correct behaviour. There are no OCaml paths which include module types that are not the leaf node, so you cannot append a path fragment to a module type path and get back a valid path.

I assume that you are trying to display a fragment like S with type t = ... with the t having a link to the type t in S. The way to do this is to take the identifier of S (using Path.Resolved.identifier) and then use Fragment.Resolved.identifier to attach the fragment to it. If either the path or the fragment are not resolved then we are unable to create a link anyway.

dsheets commented 10 years ago

This makes sense. I didn't realize that Path only admitted OCaml paths and not all reference paths. I was expecting to be able to construct partially resolved chains from a fragment but I see how these types fit together now.

Thanks!