From 5e9eab295533790e94c378610106f37a06ec9ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Fri, 3 May 2024 11:08:37 +0200 Subject: [PATCH] Pull latest changes from upstream dfe59502ad2e115882296416afc4cfd814821572 --- upstream/ocaml_502/base-rev.txt | 2 +- upstream/ocaml_502/parsing/pprintast.ml | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/upstream/ocaml_502/base-rev.txt b/upstream/ocaml_502/base-rev.txt index 1f82cfe9c..2d0acb6b3 100644 --- a/upstream/ocaml_502/base-rev.txt +++ b/upstream/ocaml_502/base-rev.txt @@ -1 +1 @@ -d38925dd59a2e620fad19ea8b14e90e4a4c1fb24 +dfe59502ad2e115882296416afc4cfd814821572 diff --git a/upstream/ocaml_502/parsing/pprintast.ml b/upstream/ocaml_502/parsing/pprintast.ml index d7fea80a7..ac20c3155 100644 --- a/upstream/ocaml_502/parsing/pprintast.ml +++ b/upstream/ocaml_502/parsing/pprintast.ml @@ -108,11 +108,12 @@ let ident_of_name ppf txt = let ident_of_name_loc ppf s = ident_of_name ppf s.txt let protect_longident ppf print_longident longprefix txt = - let format : (_, _, _) format = - if not (needs_parens txt) then "%a.%s" - else if needs_spaces txt then "%a.(@;%s@;)" - else "%a.(%s)" in - fprintf ppf format print_longident longprefix txt + if not (needs_parens txt) then + fprintf ppf "%a.%a" print_longident longprefix ident_of_name txt + else if needs_spaces txt then + fprintf ppf "%a.(@;%s@;)" print_longident longprefix txt + else + fprintf ppf "%a.(%s)" print_longident longprefix txt type space_formatter = (unit, Format.formatter, unit) format @@ -405,8 +406,11 @@ and core_type1 ctxt f x = |_ -> pp f "@[(module@ %a@ with@ %a)@]" longident_loc lid (list aux ~sep:"@ and@ ") cstrs) + | Ptyp_open(li, ct) -> + pp f "@[%a.(%a)@]" longident_loc li (core_type ctxt) ct | Ptyp_extension e -> extension ctxt f e - | _ -> paren true (core_type ctxt) f x + | (Ptyp_arrow _ | Ptyp_alias _ | Ptyp_poly _) -> + paren true (core_type ctxt) f x (********************pattern********************) (* be cautious when use [pattern], [pattern1] is preferred *) @@ -625,7 +629,7 @@ and sugar_expr ctxt f e = and function_param ctxt f param = match param.pparam_desc with | Pparam_val (a, b, c) -> label_exp ctxt f (a, b, c) - | Pparam_newtype ty -> pp f "(type %s)@;" ty.txt + | Pparam_newtype ty -> pp f "(type %a)@;" ident_of_name ty.txt and function_body ctxt f function_body = match function_body with