Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct usage example #716

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/xref2/lib/common.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ open Result

(* Example usage of these:

$ dune utop src/xref2/test/lib
$ dune utop test/xref2/lib
utop # open Odoc_xref2;;
utop # open Odoc_xref_test;;
utop # let test_data = "module type M = sig type t end module N : M type u = N.t";;
utop # let id, docs, sg = Common.model_of_string test_data;;
utop # let id, sg, docs = Common.model_of_string test_data;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last value in this triple is now the optional 'canonical' value - model_of_string ends up calling read_interface:

let read_interface root name intf =
  let id = `Root (root, Odoc_model.Names.ModuleName.make_std name) in
  let sg, canonical =
    read_signature Odoc_model.Semantics.Expect_canonical Env.empty id intf
  in
  (id, sg, (canonical :> Odoc_model.Paths.Path.Module.t option))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, so we probably need to rename the variable from docs to canonical. (Sorry for the delay to respond)

utop # let env = Env.open_signature sg Env.empty;;
utop # let unit = Common.my_compilation_unit id docs sg;
utop # let unit = Common.my_compilation_unit id sg;
utop # Common.resolve unit
utop # Resolve.signature Env.empty sg

*)

Expand Down
Loading