Skip to content
This repository
tag: v1122
Fetching contributors…

Cannot retrieve contributors at this time

file 83 lines (62 sloc) 2.737 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
(**
Error management for Opa.

@author Esther Baruk
@author Mathieu Barbin
*)

(** {6 Design note} *)

(**
This module is meant to factorize code to create located error messages, for a
public or an internal audience.

This module uses internally the [passlib] which offers the opportunity to passes
and checkers to be more verbose and outputting a detailed context in the track
system, which can be analyzed after the compilation (or after the last error),
using [opatrack]
*)

(** {6 Context} *)

module Context :
sig
  type context

  (** Merging several context *)
  val merge2 : context -> context -> context
  val merge : context -> context list -> context

  (** As we fail on surface ast, we have still all posititions from the user code *)
  val pos : FilePos.pos -> context

  (** Temporary, until we do the refactoring of pos in the Surface Ast *)
  val label : 'a QmlLoc.label -> context
  val annot : QmlLoc.annot -> context

(** if needed, add some other context constructors, and merge,
like [qmlError] *)
end

type context = Context.context

(**
The documentation of these function is in [PassHandler] and [PassError]
*)

(** {6 Interaction with Checkers} *)

(** *)
val check_fail : PassHandler.cond_id -> context -> ('a, 'error) OManager.oformat -> 'a
val scheck_fail : PassHandler.cond_id -> context -> ('a, unit) OManager.oformat -> 'a

(** {6 Interaction with Passes} *)

(** Internal Errors *)
(** *)
val cond_violation : PassHandler.cond_id -> context -> ('a, 'error) OManager.oformat -> 'a
val scond_violation : PassHandler.cond_id -> context -> ('a, unit) OManager.oformat -> 'a
val i_error : PassHandler.cond_id option -> context -> ('a, 'error) OManager.oformat -> 'a
val i_serror : PassHandler.cond_id option -> context -> ('a, unit) OManager.oformat -> 'a

(** Public Errors *)
(** *)
val error : context -> ('params, 'exit) OManager.oformat -> 'params
val serror : context -> ('params, unit) OManager.oformat -> 'params
val warning : wclass:WarningClass.wclass -> context -> ('params, unit) OManager.oformat -> 'params
Something went wrong with that request. Please try again.