File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,6 +161,11 @@ let attr ~deriver name attrs =
161161 try Some (List. find (fun ({ txt } , _ ) -> txt = name) attrs)
162162 with Not_found -> None
163163
164+ let attr_warning expr =
165+ let loc = ! default_loc in
166+ let structure = {pstr_desc = Pstr_eval (expr, [] ); pstr_loc = loc} in
167+ {txt = " ocaml.warning" ; loc}, PStr [structure]
168+
164169let fold_left_type_params fn accum params =
165170 List. fold_left (fun accum (param , _ ) ->
166171 match param with
Original file line number Diff line number Diff line change @@ -159,6 +159,9 @@ val mangle_lid : ?fixpoint:string ->
159159 or [\[\@attr\]] otherwise. *)
160160val attr : deriver :string -> string -> attributes -> attribute option
161161
162+ (* * [attr_warning expr] builds the attribute [@ocaml.warning expr] *)
163+ val attr_warning : expression -> attribute
164+
162165(* * [free_vars_in_core_type typ] returns unique free variables in [typ] in
163166 lexical order. *)
164167val free_vars_in_core_type : core_type -> string list
@@ -239,7 +242,7 @@ val seq_reduce : ?sep:expression -> expression -> expression -> expression
239242(* * [binop_reduce] ≡ [fun x a b -> [%expr [%e x] [%e a] [%e b]]]. *)
240243val binop_reduce : expression -> expression -> expression -> expression
241244
242- (* * [strong_type_of_type ty] transform a type ty to
245+ (* * [strong_type_of_type ty] transform a type ty to
243246 [freevars . ty], giving a strong polymorphic type *)
244247val strong_type_of_type : core_type -> core_type
245248
Original file line number Diff line number Diff line change @@ -46,14 +46,9 @@ let wildcard_case int_cases =
4646 let to_int = [% e Exp. function_ int_cases] in
4747 Pervasives. compare (to_int lhs) (to_int rhs)]
4848
49- let attr_warning expr =
50- let loc = ! default_loc in
51- let structure = {pstr_desc = Pstr_eval (expr, [] ); pstr_loc = loc} in
52- {txt = " ocaml.warning" ; loc}, PStr [structure]
53-
5449(* deactivate warning 4 in code that uses [wildcard_case] *)
5550let warning_minus_4 =
56- attr_warning [% expr " -4" ]
51+ Ppx_deriving. attr_warning [% expr " -4" ]
5752
5853let pattn side typs =
5954 List. mapi (fun i _ -> pvar (argn side i)) typs
You can’t perform that action at this time.
0 commit comments