@@ -404951,9 +404951,10 @@ let eraseTypeStr =
404951404951 )
404952404952let unsafeIndex = "_index"
404953404953let unsafeIndexGet =
404954+ let any = Typ.any () in
404954404955 Str.primitive
404955404956 (Val.mk ~prim:[""] {loc = noloc; txt = unsafeIndex} ~attrs:[Ast_attributes.bs_get_index]
404956- (Ast_compatible.arrow (Typ.var "b") (Ast_compatible.arrow (Typ.var "a") (Typ.var "c") ))
404957+ (Ast_compatible.arrow any (Ast_compatible.arrow any any ))
404957404958 )
404958404959let unsafeIndexGetExp = (Exp.ident {loc = noloc; txt = Lident unsafeIndex})
404959404960(* JavaScript has allowed trailing commas in array literals since the beginning,
@@ -406021,21 +406022,24 @@ let refine_arg_type ~(nolabel:bool) (ptyp : Ast_core_type.t)
406021406022 (if ptyp.ptyp_desc = Ptyp_any then
406022406023 let ptyp_attrs = ptyp.ptyp_attributes in
406023406024 let result = Ast_attributes.iter_process_bs_string_or_int_as ptyp_attrs in
406024- (* when ppx start dropping attributes
406025- we should warn, there is a trade off whether
406026- we should warn dropped non bs attribute or not
406027- *)
406028- Bs_ast_invariant.warn_discarded_unused_attributes ptyp_attrs;
406029406025 match result with
406030406026 | None ->
406031- Bs_syntaxerr.err ptyp.ptyp_loc Invalid_underscore_type_in_external
406032- | Some (Int i) -> (* (_[@bs.as ])*)
406033- (* This type is used in bs.obj only to construct obj type*)
406034- Arg_cst(External_arg_spec.cst_int i)
406035- | Some (Str i)->
406036- Arg_cst (External_arg_spec.cst_string i)
406037- | Some (Js_literal_str s) ->
406038- Arg_cst (External_arg_spec.cst_obj_literal s)
406027+ spec_of_ptyp nolabel ptyp
406028+ | Some cst -> (* (_[@bs.as ])*)
406029+ (* when ppx start dropping attributes
406030+ we should warn, there is a trade off whether
406031+ we should warn dropped non bs attribute or not
406032+ *)
406033+ Bs_ast_invariant.warn_discarded_unused_attributes ptyp_attrs;
406034+ begin match cst with
406035+ | Int i ->
406036+ (* This type is used in bs.obj only to construct obj type*)
406037+ Arg_cst(External_arg_spec.cst_int i)
406038+ | Str i->
406039+ Arg_cst (External_arg_spec.cst_string i)
406040+ | Js_literal_str s ->
406041+ Arg_cst (External_arg_spec.cst_obj_literal s)
406042+ end
406039406043 else (* ([`a|`b] [@bs.string]) *)
406040406044 spec_of_ptyp nolabel ptyp
406041406045 )
0 commit comments