Commit 592692b6 authored by POTTIER Francois's avatar POTTIER Francois

Modified [warning] to directly accept a format.

parent c80aabac
...@@ -62,10 +62,9 @@ include WarningStore(struct end) ...@@ -62,10 +62,9 @@ include WarningStore(struct end)
let datacon_opacity_warning (cd : constructor_declaration) : unit = let datacon_opacity_warning (cd : constructor_declaration) : unit =
if opacity cd.pcd_attributes = Opaque then if opacity cd.pcd_attributes = Opaque then
warning cd.pcd_loc warning cd.pcd_loc
(sprintf "%s: @opaque, attached to a data constructor, is ignored.\n\
"%s: @opaque, attached to a data constructor, is ignored.\n\ It should be attached to a type. Please use parentheses."
It should be attached to a type. Please use parentheses." plugin
plugin)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
...@@ -572,8 +572,8 @@ end ...@@ -572,8 +572,8 @@ end
module WarningStore (X : sig end) : sig module WarningStore (X : sig end) : sig
(* [warning loc msg] emits a warning. *) (* [warning loc format ...] emits a warning. *)
val warning: loc -> string -> unit val warning: loc -> ('a, unit, string, unit) format4 -> 'a
(* [warnings()] returns a list of all warnings emitted so far. *) (* [warnings()] returns a list of all warnings emitted so far. *)
val warnings: unit -> structure val warnings: unit -> structure
...@@ -586,6 +586,9 @@ end = struct ...@@ -586,6 +586,9 @@ end = struct
let warning loc msg = let warning loc msg =
warnings := Ast_mapper.attribute_of_warning loc msg :: !warnings warnings := Ast_mapper.attribute_of_warning loc msg :: !warnings
let warning loc format =
Printf.ksprintf (warning loc) format
let warnings () = let warnings () =
let ws = !warnings in let ws = !warnings in
warnings := []; warnings := [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment