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/oprint.ml | |
| parent | f814450b605852429613e4ae7f68bac0382e3f1d (diff) | |
| download | ocaml-pr8908.tar.gz | |
PR#8908: used as a base for other PRs.pr8908
Diffstat (limited to 'typing/oprint.ml')
| -rw-r--r-- | typing/oprint.ml | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/typing/oprint.ml b/typing/oprint.ml index 47efee6116..941ae5729f 100644 --- a/typing/oprint.ml +++ b/typing/oprint.ml @@ -484,14 +484,15 @@ let out_type_extension = ref (fun _ -> failwith "Oprint.out_type_extension") that should be printed in long form. *) let collect_functor_arguments mty = let rec collect_args acc = function - | Omty_functor (name, mty_arg, mty_res) -> - collect_args ((name, mty_arg) :: acc) mty_res + | Omty_functor (param, mty_res) -> + collect_args (param :: acc) mty_res | non_functor -> (acc, non_functor) in let rec uncollect_anonymous_suffix acc rest = match acc with - | ("_", mty_arg) :: acc -> - uncollect_anonymous_suffix acc (Omty_functor ("_", mty_arg, rest)) - | (_, _) :: _ | [] -> + | Some (None, mty_arg) :: acc -> + uncollect_anonymous_suffix acc + (Omty_functor (Some (None, mty_arg), rest)) + | _ :: _ | [] -> (acc, rest) in let (acc, non_functor) = collect_args [] mty in @@ -503,18 +504,18 @@ let rec print_out_module_type ppf mty = and print_out_functor ppf = function | Omty_functor _ as t -> let rec print_functor ppf = function - | Omty_functor ("_", Some mty_arg, mty_res) -> + | Omty_functor (Some (None, mty_arg), mty_res) -> fprintf ppf "%a ->@ %a" print_simple_out_module_type mty_arg print_functor mty_res | Omty_functor _ as non_anonymous_functor -> let (args, rest) = collect_functor_arguments non_anonymous_functor in let print_arg ppf = function - | (_, None) -> + | None -> fprintf ppf "()" - | (name, Some mty) -> + | Some (param, mty) -> fprintf ppf "(%s : %a)" - name + (Option.value param ~default:"_") print_out_module_type mty in fprintf ppf "@[<2>functor@ %a@]@ ->@ %a" |
