diff --git a/jscomp/syntax/src/res_core.ml b/jscomp/syntax/src/res_core.ml index 189d17c0d48..72617b4141d 100644 --- a/jscomp/syntax/src/res_core.ml +++ b/jscomp/syntax/src/res_core.ml @@ -175,7 +175,7 @@ let suppress_fragile_match_warning_attr = ] ) let make_braces_attr loc = (Location.mkloc "res.braces" loc, Parsetree.PStr []) let template_literal_attr = (Location.mknoloc "res.template", Parsetree.PStr []) -let makePatVariantSpreadAttr = +let make_pat_variant_spread_attr = (Location.mknoloc "res.patVariantSpread", Parsetree.PStr []) let tagged_template_literal_attr = @@ -1083,7 +1083,7 @@ let rec parse_pattern ?(alias = true) ?(or_ = true) p = Parser.next p; let ident = parse_value_path p in let loc = mk_loc start_pos ident.loc.loc_end in - Ast_helper.Pat.type_ ~loc ~attrs:(makePatVariantSpreadAttr :: attrs) ident + Ast_helper.Pat.type_ ~loc ~attrs:(make_pat_variant_spread_attr :: attrs) ident | Hash -> ( Parser.next p; if p.Parser.token == DotDotDot then ( diff --git a/jscomp/syntax/src/res_parsetree_viewer.ml b/jscomp/syntax/src/res_parsetree_viewer.ml index eefdc800ce0..20478bb5594 100644 --- a/jscomp/syntax/src/res_parsetree_viewer.ml +++ b/jscomp/syntax/src/res_parsetree_viewer.ml @@ -97,7 +97,7 @@ let has_await_attribute attrs = | _ -> false) attrs -let hasResPatVariantSpreadAttribute attrs = +let has_res_pat_variant_spread_attribute attrs = List.exists (function | {Location.txt = "res.patVariantSpread"}, _ -> true diff --git a/jscomp/syntax/src/res_parsetree_viewer.mli b/jscomp/syntax/src/res_parsetree_viewer.mli index c6a72d35d21..286515e274f 100644 --- a/jscomp/syntax/src/res_parsetree_viewer.mli +++ b/jscomp/syntax/src/res_parsetree_viewer.mli @@ -26,7 +26,7 @@ val process_function_attributes : Parsetree.attributes -> function_attributes_info val has_await_attribute : Parsetree.attributes -> bool -val hasResPatVariantSpreadAttribute : Parsetree.attributes -> bool +val has_res_pat_variant_spread_attribute : Parsetree.attributes -> bool type if_condition_kind = | If of Parsetree.expression diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index 83da42ae7e2..4d96106c77e 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -2406,7 +2406,8 @@ and print_pattern ~state (p : Parsetree.pattern) cmt_tbl = Doc.group (Doc.concat [variant_name; args_doc]) | Ppat_type ident -> let prefix = - if ParsetreeViewer.hasResPatVariantSpreadAttribute p.ppat_attributes + if + ParsetreeViewer.has_res_pat_variant_spread_attribute p.ppat_attributes then "" else "#" in