@@ -100,21 +100,24 @@ let refine_arg_type ~(nolabel:bool) (ptyp : Ast_core_type.t)
100
100
(if ptyp.ptyp_desc = Ptyp_any then
101
101
let ptyp_attrs = ptyp.ptyp_attributes in
102
102
let result = Ast_attributes. iter_process_bs_string_or_int_as ptyp_attrs in
103
- (* when ppx start dropping attributes
104
- we should warn, there is a trade off whether
105
- we should warn dropped non bs attribute or not
106
- *)
107
- Bs_ast_invariant. warn_discarded_unused_attributes ptyp_attrs;
108
103
match result with
109
104
| None ->
110
- Bs_syntaxerr. err ptyp.ptyp_loc Invalid_underscore_type_in_external
111
- | Some (Int i ) -> (* (_[@bs.as ])*)
112
- (* This type is used in bs.obj only to construct obj type*)
113
- Arg_cst (External_arg_spec. cst_int i)
114
- | Some (Str i )->
115
- Arg_cst (External_arg_spec. cst_string i)
116
- | Some (Js_literal_str s ) ->
117
- Arg_cst (External_arg_spec. cst_obj_literal s)
105
+ spec_of_ptyp nolabel ptyp
106
+ | Some cst -> (* (_[@bs.as ])*)
107
+ (* when ppx start dropping attributes
108
+ we should warn, there is a trade off whether
109
+ we should warn dropped non bs attribute or not
110
+ *)
111
+ Bs_ast_invariant. warn_discarded_unused_attributes ptyp_attrs;
112
+ begin match cst with
113
+ | Int i ->
114
+ (* This type is used in bs.obj only to construct obj type*)
115
+ Arg_cst (External_arg_spec. cst_int i)
116
+ | Str i ->
117
+ Arg_cst (External_arg_spec. cst_string i)
118
+ | Js_literal_str s ->
119
+ Arg_cst (External_arg_spec. cst_obj_literal s)
120
+ end
118
121
else (* ([`a|`b] [@bs.string]) *)
119
122
spec_of_ptyp nolabel ptyp
120
123
)
0 commit comments