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

Extended open #393

Merged
merged 11 commits into from
Nov 11, 2019
Merged

Extended open #393

merged 11 commits into from
Nov 11, 2019

Conversation

jonludlam
Copy link
Member

@jonludlam jonludlam commented Oct 18, 2019

Handle generalized open statements in cmt files. For review, since I've not implemented the signature side of this yet. Now complete and ready to review.

Signed-off-by: Jon Ludlam <jon@recoil.org>
Signed-off-by: Jon Ludlam <jon@recoil.org>
We do this by introducing an artificial module at the point the `open`
occurs. For example:

```ocaml
open (Foo : module type of Foo with module A := Foo.A)
```

becomes effectively:

```ocaml
(**/**)
module Open__<line>_<col> : module type of Foo with module A := Foo.A
(**/**)
```

and we 'open' this by putting all of the identifiers into the environment.
All of these `Ident.t` values are associated with 'Internal' names that
are always hidden, and hence the resolution step ends up resolving them to
the non-hidden identifiers.

It is an error to try and turn the 'Internal' identifiers back into strings
in the HTML generator to ensure they don't leak out into the documentation.

Signed-off-by: Jon Ludlam <jon@recoil.org>
Until we can properly abstract types that refer to hidden items
(ie, until the model rewrite lands), we'll allow these internal
names to be exposed (prefixed with '$' to point them out).

Signed-off-by: Jon Ludlam <jon@recoil.org>
Signed-off-by: Jon Ludlam <jon@recoil.org>
@jonludlam
Copy link
Member Author

Looks like I've added a couple of binary files by mistake. I'll remove them when I'm back in front of my computer.

Signed-off-by: Jon Ludlam <jon@recoil.org>
Signed-off-by: Jon Ludlam <jon@recoil.org>
Signed-off-by: Jon Ludlam <jon@recoil.org>
Copy link
Member

@avsm avsm left a comment

Choose a reason for hiding this comment

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

Just minor comments from me, but this looks fairly well bounded behind 4.08-specific checks and has sufficient test cases to merge.

src/model/ident_env.cppo.ml Outdated Show resolved Hide resolved
src/model/names.ml Show resolved Hide resolved
src/model/names.mli Show resolved Hide resolved
@trefis
Copy link
Contributor

trefis commented Nov 4, 2019

Sorry for the delay, I'll try to review this tomorrow.

src/model/ident_env.cppo.ml Show resolved Hide resolved
src/model/ident_env.cppo.ml Outdated Show resolved Hide resolved
Signed-off-by: Jon Ludlam <jon@recoil.org>
Most `open` statements don't create anything new, so in the majority
of cases we can skip a chunk of work. Optimization pointed out by
@trefis.

Signed-off-by: Jon Ludlam <jon@recoil.org>
src/model/paths.ml Outdated Show resolved Hide resolved
- Don't use to_string_unsafe (yet)
- Document that to_string doesn't currently raise exceptions
- Extend test to ensure standard use of open isn't affected

Signed-off-by: Jon Ludlam <jon@recoil.org>
@trefis trefis merged commit 1524818 into ocaml:master Nov 11, 2019
jonludlam added a commit to jonludlam/opam-repository that referenced this pull request Feb 7, 2020
CHANGES:

Additions

- Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon)

Bugs fixed

- Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin)
- Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam)
- Refactor error reporting to avoid exiting the program in library code
  (ocaml/odoc#400, Jules Aguillon)
- Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
mgree pushed a commit to mgree/opam-repository that referenced this pull request Feb 19, 2020
CHANGES:

Additions

- Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon)

Bugs fixed

- Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin)
- Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam)
- Refactor error reporting to avoid exiting the program in library code
  (ocaml/odoc#400, Jules Aguillon)
- Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants