diff options
| author | Thomas Refis <thomas.refis@gmail.com> | 2019-09-02 11:43:26 +0100 |
|---|---|---|
| committer | Thomas Refis <thomas.refis@gmail.com> | 2019-09-11 13:44:31 -0400 |
| commit | 6f492fdbd9c352c0502c118a80d451b8867b1dae (patch) | |
| tree | 7957c84f5a7425a87a8aaa99f261f18750daec3f /typing/printtyp.ml | |
| parent | f814450b605852429613e4ae7f68bac0382e3f1d (diff) | |
| download | ocaml-pr8908.tar.gz | |
PR#8908: used as a base for other PRs.pr8908
Diffstat (limited to 'typing/printtyp.ml')
| -rw-r--r-- | typing/printtyp.ml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/typing/printtyp.ml b/typing/printtyp.ml index 069173e901..c39f04d3ce 100644 --- a/typing/printtyp.ml +++ b/typing/printtyp.ml @@ -1625,15 +1625,22 @@ let rec tree_of_modtype ?(ellipsis=false) = function | Mty_signature sg -> Omty_signature (if ellipsis then [Osig_ellipsis] else tree_of_signature sg) - | Mty_functor(param, ty_arg, ty_res) -> - let res = - match ty_arg with None -> tree_of_modtype ~ellipsis ty_res - | Some mty -> - wrap_env (Env.add_module ~arg:true param Mp_present mty) - (tree_of_modtype ~ellipsis) ty_res + | Mty_functor(param, ty_res) -> + let param, res = + match param with + | Unit -> None, tree_of_modtype ~ellipsis ty_res + | Named (param, ty_arg) -> + let name, env = + match param with + | None -> None, fun env -> env + | Some id -> + Some (Ident.name id), + Env.add_module ~arg:true id Mp_present ty_arg + in + Some (name, tree_of_modtype ~ellipsis:false ty_arg), + wrap_env env (tree_of_modtype ~ellipsis) ty_res in - Omty_functor (Ident.name param, - Option.map (tree_of_modtype ~ellipsis:false) ty_arg, res) + Omty_functor (param, res) | Mty_alias p -> Omty_alias (tree_of_path Module p) |
