odoc icon indicating copy to clipboard operation
odoc copied to clipboard

References to outside of module types must be fully qualified

Open Julow opened this issue 3 years ago • 3 comments

module X : sig

  module type T = sig
    (** {!t} *)
  end

  type t

end

module Y : X.T

The reference that's inside X.T won't resolve in the expansion of Y.

Annoyingly, the error message points to the reference and not to Y at all:

File "test.mli", line 4, characters 8-12:
Failed to resolve reference unresolvedroot(t) Couldn't find "t"

Julow avatar Oct 07 '21 18:10 Julow

A similar issue is synopsis that contain references, these references won't resolve when shown in the parent page. These references must be fully-qualified and might not be resolved: https://github.com/ocaml/odoc/pull/658

Perhaps the same rule can be applied to references in module types that point to outside of the module type ? (suggested by @jonludlam )

Julow avatar Oct 07 '21 18:10 Julow

Module types are where these issues are likely to show up the most, but the same problem applies anywhere where we build expansions. The problem is that the references are all resolved after the expansion has happened, so the original context is gone. Stdlib currently has a few of these sorts of issues - e.g. https://github.com/ocaml/ocaml/blob/45612f14afc1abaa19d8585ec1f48c3cbbfbc652/stdlib/map.mli#L242

jonludlam avatar Oct 07 '21 23:10 jonludlam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. The main purpose of this is to keep the issue tracker focused to what is actively being worked on, so that the amount and variety of open yet inactive issues does not overwhelm contributors.

An issue closed as stale is not rejected — further discussion is welcome in its closed state, and it can be resurrected at any time. odoc maintainers regularly check issues that were closed as stale in the past, to see if the time is right to reopen and work on them again. PRs addressing issues closed as stale are as welcome as PRs for open issues. They will be given the same review attention, and any other help.

github-actions[bot] avatar Aug 07 '23 17:08 github-actions[bot]