about summary refs log tree commit diff
path: root/lib/Reporter.ml
blob: c86a04af43dc4733afef872afe8f30f8a3229cfa (plain)
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
module Message =
struct
  type t = 
    | SyntaxError
    | IllTyped
    | UnboundVariable
    | CannotInferType

  let default_severity : t -> Asai.Diagnostic.severity =
    function
    | SyntaxError -> Error
    | IllTyped -> Error
    | UnboundVariable -> Error
    | CannotInferType -> Error

  let short_code : t -> string =
    function
    | SyntaxError -> "E0001"
    | IllTyped -> "E0002"
    | UnboundVariable -> "E0003"
    | CannotInferType -> "E0004"
end

include Asai.Reporter.Make(Message)

let invalid_local_name (name : Ast.raw_ident) = fatalf SyntaxError "invalid local variable name `%a`" Ast.dump_raw_ident name

let expected_universe fmt x = fatalf IllTyped "expected a universe but got %a" fmt x