2222 * along with this program; if not, write to the Free Software
2323 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424
25- [@@@ warning " +9" ]
26- (* record pattern match complete checker*)
27-
2825let rec variant_can_unwrap_aux (row_fields : Parsetree.row_field list ) : bool =
2926 match row_fields with
3027 | [] -> true
@@ -68,7 +65,7 @@ let spec_of_ptyp (nolabel : bool) (ptyp : Parsetree.core_type) :
6865 | _ -> Bs_syntaxerr. err ptyp.ptyp_loc Invalid_bs_unwrap_type )
6966 | `Nothing -> (
7067 match ptyp_desc with
71- | Ptyp_constr ({txt = Lident "unit" ; _ } , [] ) ->
68+ | Ptyp_constr ({txt = Lident "unit" } , [] ) ->
7269 if nolabel then Extern_unit else Nothing
7370 | _ -> Nothing )
7471
@@ -257,7 +254,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
257254 {
258255 pstr_desc =
259256 Pstr_eval
260- ({pexp_loc; pexp_desc = Pexp_record (fields, _); _ }, _);
257+ ({pexp_loc; pexp_desc = Pexp_record (fields, _)}, _);
261258 _;
262259 };
263260 ] -> (
@@ -270,10 +267,10 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
270267 Longident. t Location. loc * Parsetree. expression * bool )
271268 ->
272269 match (l, exp.pexp_desc) with
273- | ( {txt = Lident " from" ; _ },
270+ | ( {txt = Lident " from" },
274271 Pexp_constant (Pconst_string (s, _)) ) ->
275272 from_name := Some s
276- | {txt = Lident "with" ; _ } , Pexp_record (fields , _ ) ->
273+ | {txt = Lident "with" } , Pexp_record (fields , _ ) ->
277274 with_ := Some fields
278275 | _ -> () );
279276 match (! from_name, ! with_) with
@@ -395,7 +392,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
395392 | "return" -> (
396393 let actions = Ast_payload. ident_or_record_as_config loc payload in
397394 match actions with
398- | [({txt; _ }, None )] ->
395+ | [({txt}, None )] ->
399396 {st with return_wrapper = return_wrapper loc txt}
400397 | _ -> Bs_syntaxerr. err loc Not_supported_directive_in_bs_return )
401398 | _ -> raise_notrace Not_handled_external_attribute
@@ -467,7 +464,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
467464 match arg_label with
468465 | Nolabel -> (
469466 match ty.ptyp_desc with
470- | Ptyp_constr ({txt = Lident "unit" ; _ } , [] ) ->
467+ | Ptyp_constr ({txt = Lident "unit" } , [] ) ->
471468 ( External_arg_spec. empty_kind Extern_unit ,
472469 param_type :: arg_types,
473470 result_types )
@@ -550,7 +547,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
550547 | Nothing ->
551548 let for_sure_not_nested =
552549 match ty.ptyp_desc with
553- | Ptyp_constr ({txt = Lident txt ; _ } , [] ) ->
550+ | Ptyp_constr ({txt = Lident txt } , [] ) ->
554551 Ast_core_type. is_builtin_rank0_type txt
555552 | _ -> false
556553 in
@@ -643,7 +640,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
643640 else
644641 Location. raise_errorf ~loc
645642 " Ill defined attribute %@set_index (arity of 3)"
646- | {set_index = true ; _ } ->
643+ | {set_index = true } ->
647644 Bs_syntaxerr. err loc
648645 (Conflict_ffi_attribute " Attribute found that conflicts with %@set_index" )
649646 | {
@@ -669,7 +666,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
669666 Location. raise_errorf ~loc
670667 " Ill defined attribute %@get_index (arity expected 2 : while %d)"
671668 arg_type_specs_length
672- | {get_index = true ; _ } ->
669+ | {get_index = true } ->
673670 Bs_syntaxerr. err loc
674671 (Conflict_ffi_attribute " Attribute found that conflicts with %@get_index" )
675672 | {
@@ -702,7 +699,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
702699 Location. raise_errorf ~loc
703700 " Incorrect FFI attribute found: (%@new should not carry a payload here)"
704701 )
705- | {module_as_val = Some _ ; get_index; val_send; _ } ->
702+ | {module_as_val = Some _ ; get_index; val_send} ->
706703 let reason =
707704 match (get_index, val_send) with
708705 | true , _ ->
@@ -770,7 +767,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
770767 Js_var {name; external_module_name; scopes}
771768 (* FIXME: splice is not supported here *)
772769 else Js_call {splice; name; external_module_name; scopes; tagged_template}
773- | {call_name = Some _ ; _ } ->
770+ | {call_name = Some _ } ->
774771 Bs_syntaxerr. err loc
775772 (Conflict_ffi_attribute " Attribute found that conflicts with %@val" )
776773 | {
@@ -797,7 +794,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
797794 ]}
798795 *)
799796 Js_var {name; external_module_name; scopes}
800- | {val_name = Some _ ; _ } ->
797+ | {val_name = Some _ } ->
801798 Bs_syntaxerr. err loc
802799 (Conflict_ffi_attribute " Attribute found that conflicts with %@val" )
803800 | {
@@ -855,7 +852,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
855852 Location. raise_errorf ~loc
856853 " Ill defined attribute %@send(first argument can't be const)"
857854 | _ :: _ -> Js_send {splice; name; js_send_scopes = scopes})
858- | {val_send = Some _ ; _ } ->
855+ | {val_send = Some _ } ->
859856 Location. raise_errorf ~loc
860857 " You used a FFI attribute that can't be used with %@send"
861858 | {
@@ -876,7 +873,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
876873 tagged_template = _;
877874 } ->
878875 Js_new {name; external_module_name; splice; scopes}
879- | {new_name = Some _ ; _ } ->
876+ | {new_name = Some _ } ->
880877 Bs_syntaxerr. err loc
881878 (Conflict_ffi_attribute " Attribute found that conflicts with %@new" )
882879 | {
@@ -901,7 +898,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
901898 else
902899 Location. raise_errorf ~loc
903900 " Ill defined attribute %@set (two args required)"
904- | {set_name = Some _ ; _ } ->
901+ | {set_name = Some _ } ->
905902 Location. raise_errorf ~loc " conflict attributes found with %@set"
906903 | {
907904 get_name = Some {name; source = _};
@@ -925,7 +922,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
925922 else
926923 Location. raise_errorf ~loc
927924 " Ill defined attribute %@get (only one argument)"
928- | {get_name = Some _ ; _ } ->
925+ | {get_name = Some _ } ->
929926 Location. raise_errorf ~loc " Attribute found that conflicts with %@get"
930927
931928(* * Note that the passed [type_annotation] is already processed by visitor pattern before*)
@@ -935,8 +932,8 @@ let handle_attributes (loc : Bs_loc.t) (type_annotation : Parsetree.core_type)
935932 let prim_name_with_source = {name = prim_name; source = External } in
936933 let type_annotation, build_uncurried_type =
937934 match type_annotation with
938- | {ptyp_desc = Ptyp_arrow ( _ , _ , _ , Some _ ); _} as t ->
939- ( t ,
935+ | {ptyp_desc = Ptyp_arrow { arity = Some _ } } ->
936+ ( type_annotation ,
940937 fun ~arity (x : Parsetree.core_type ) ->
941938 Ast_uncurried. uncurried_type ~arity x )
942939 | _ -> (type_annotation, fun ~arity :_ x -> x)
@@ -978,7 +975,7 @@ let handle_attributes (loc : Bs_loc.t) (type_annotation : Parsetree.core_type)
978975 Location. raise_errorf ~loc
979976 " %@variadic expect the last type to be an array" ;
980977 match ty.ptyp_desc with
981- | Ptyp_constr ({txt = Lident "array" ; _ } , [_ ]) -> ()
978+ | Ptyp_constr ({txt = Lident "array" } , [_ ]) -> ()
982979 | _ ->
983980 Location. raise_errorf ~loc
984981 " %@variadic expect the last type to be an array" ));
0 commit comments