22
22
* along with this program; if not, write to the Free Software
23
23
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
24
24
25
- [@@@ warning " +9" ]
26
- (* record pattern match complete checker*)
27
-
28
25
let rec variant_can_unwrap_aux (row_fields : Parsetree.row_field list ) : bool =
29
26
match row_fields with
30
27
| [] -> true
@@ -68,7 +65,7 @@ let spec_of_ptyp (nolabel : bool) (ptyp : Parsetree.core_type) :
68
65
| _ -> Bs_syntaxerr. err ptyp.ptyp_loc Invalid_bs_unwrap_type )
69
66
| `Nothing -> (
70
67
match ptyp_desc with
71
- | Ptyp_constr ({txt = Lident "unit" ; _ } , [] ) ->
68
+ | Ptyp_constr ({txt = Lident "unit" } , [] ) ->
72
69
if nolabel then Extern_unit else Nothing
73
70
| _ -> Nothing )
74
71
@@ -257,7 +254,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
257
254
{
258
255
pstr_desc =
259
256
Pstr_eval
260
- ({pexp_loc; pexp_desc = Pexp_record (fields, _); _ }, _);
257
+ ({pexp_loc; pexp_desc = Pexp_record (fields, _)}, _);
261
258
_;
262
259
};
263
260
] -> (
@@ -270,10 +267,10 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
270
267
Longident. t Location. loc * Parsetree. expression * bool )
271
268
->
272
269
match (l, exp.pexp_desc) with
273
- | ( {txt = Lident " from" ; _ },
270
+ | ( {txt = Lident " from" },
274
271
Pexp_constant (Pconst_string (s, _)) ) ->
275
272
from_name := Some s
276
- | {txt = Lident "with" ; _ } , Pexp_record (fields , _ ) ->
273
+ | {txt = Lident "with" } , Pexp_record (fields , _ ) ->
277
274
with_ := Some fields
278
275
| _ -> () );
279
276
match (! from_name, ! with_) with
@@ -395,7 +392,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
395
392
| "return" -> (
396
393
let actions = Ast_payload. ident_or_record_as_config loc payload in
397
394
match actions with
398
- | [({txt; _ }, None )] ->
395
+ | [({txt}, None )] ->
399
396
{st with return_wrapper = return_wrapper loc txt}
400
397
| _ -> Bs_syntaxerr. err loc Not_supported_directive_in_bs_return )
401
398
| _ -> raise_notrace Not_handled_external_attribute
@@ -467,7 +464,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
467
464
match arg_label with
468
465
| Nolabel -> (
469
466
match ty.ptyp_desc with
470
- | Ptyp_constr ({txt = Lident "unit" ; _ } , [] ) ->
467
+ | Ptyp_constr ({txt = Lident "unit" } , [] ) ->
471
468
( External_arg_spec. empty_kind Extern_unit ,
472
469
param_type :: arg_types,
473
470
result_types )
@@ -550,7 +547,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
550
547
| Nothing ->
551
548
let for_sure_not_nested =
552
549
match ty.ptyp_desc with
553
- | Ptyp_constr ({txt = Lident txt ; _ } , [] ) ->
550
+ | Ptyp_constr ({txt = Lident txt } , [] ) ->
554
551
Ast_core_type. is_builtin_rank0_type txt
555
552
| _ -> false
556
553
in
@@ -643,7 +640,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
643
640
else
644
641
Location. raise_errorf ~loc
645
642
" Ill defined attribute %@set_index (arity of 3)"
646
- | {set_index = true ; _ } ->
643
+ | {set_index = true } ->
647
644
Bs_syntaxerr. err loc
648
645
(Conflict_ffi_attribute " Attribute found that conflicts with %@set_index" )
649
646
| {
@@ -669,7 +666,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
669
666
Location. raise_errorf ~loc
670
667
" Ill defined attribute %@get_index (arity expected 2 : while %d)"
671
668
arg_type_specs_length
672
- | {get_index = true ; _ } ->
669
+ | {get_index = true } ->
673
670
Bs_syntaxerr. err loc
674
671
(Conflict_ffi_attribute " Attribute found that conflicts with %@get_index" )
675
672
| {
@@ -702,7 +699,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
702
699
Location. raise_errorf ~loc
703
700
" Incorrect FFI attribute found: (%@new should not carry a payload here)"
704
701
)
705
- | {module_as_val = Some _ ; get_index; val_send; _ } ->
702
+ | {module_as_val = Some _ ; get_index; val_send} ->
706
703
let reason =
707
704
match (get_index, val_send) with
708
705
| true , _ ->
@@ -770,7 +767,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
770
767
Js_var {name; external_module_name; scopes}
771
768
(* FIXME: splice is not supported here *)
772
769
else Js_call {splice; name; external_module_name; scopes; tagged_template}
773
- | {call_name = Some _ ; _ } ->
770
+ | {call_name = Some _ } ->
774
771
Bs_syntaxerr. err loc
775
772
(Conflict_ffi_attribute " Attribute found that conflicts with %@val" )
776
773
| {
@@ -797,7 +794,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
797
794
]}
798
795
*)
799
796
Js_var {name; external_module_name; scopes}
800
- | {val_name = Some _ ; _ } ->
797
+ | {val_name = Some _ } ->
801
798
Bs_syntaxerr. err loc
802
799
(Conflict_ffi_attribute " Attribute found that conflicts with %@val" )
803
800
| {
@@ -855,7 +852,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
855
852
Location. raise_errorf ~loc
856
853
" Ill defined attribute %@send(first argument can't be const)"
857
854
| _ :: _ -> Js_send {splice; name; js_send_scopes = scopes})
858
- | {val_send = Some _ ; _ } ->
855
+ | {val_send = Some _ } ->
859
856
Location. raise_errorf ~loc
860
857
" You used a FFI attribute that can't be used with %@send"
861
858
| {
@@ -876,7 +873,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
876
873
tagged_template = _;
877
874
} ->
878
875
Js_new {name; external_module_name; splice; scopes}
879
- | {new_name = Some _ ; _ } ->
876
+ | {new_name = Some _ } ->
880
877
Bs_syntaxerr. err loc
881
878
(Conflict_ffi_attribute " Attribute found that conflicts with %@new" )
882
879
| {
@@ -901,7 +898,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
901
898
else
902
899
Location. raise_errorf ~loc
903
900
" Ill defined attribute %@set (two args required)"
904
- | {set_name = Some _ ; _ } ->
901
+ | {set_name = Some _ } ->
905
902
Location. raise_errorf ~loc " conflict attributes found with %@set"
906
903
| {
907
904
get_name = Some {name; source = _};
@@ -925,7 +922,7 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
925
922
else
926
923
Location. raise_errorf ~loc
927
924
" Ill defined attribute %@get (only one argument)"
928
- | {get_name = Some _ ; _ } ->
925
+ | {get_name = Some _ } ->
929
926
Location. raise_errorf ~loc " Attribute found that conflicts with %@get"
930
927
931
928
(* * 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)
935
932
let prim_name_with_source = {name = prim_name; source = External } in
936
933
let type_annotation, build_uncurried_type =
937
934
match type_annotation with
938
- | {ptyp_desc = Ptyp_arrow ( _ , _ , _ , Some _ ); _} as t ->
939
- ( t ,
935
+ | {ptyp_desc = Ptyp_arrow { arity = Some _ } } ->
936
+ ( type_annotation ,
940
937
fun ~arity (x : Parsetree.core_type ) ->
941
938
Ast_uncurried. uncurried_type ~arity x )
942
939
| _ -> (type_annotation, fun ~arity :_ x -> x)
@@ -978,7 +975,7 @@ let handle_attributes (loc : Bs_loc.t) (type_annotation : Parsetree.core_type)
978
975
Location. raise_errorf ~loc
979
976
" %@variadic expect the last type to be an array" ;
980
977
match ty.ptyp_desc with
981
- | Ptyp_constr ({txt = Lident "array" ; _ } , [_ ]) -> ()
978
+ | Ptyp_constr ({txt = Lident "array" } , [_ ]) -> ()
982
979
| _ ->
983
980
Location. raise_errorf ~loc
984
981
" %@variadic expect the last type to be an array" ));
0 commit comments