diff options
Diffstat (limited to 'lib/Reporter.ml')
-rw-r--r-- | lib/Reporter.ml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Reporter.ml b/lib/Reporter.ml new file mode 100644 index 0000000..c86a04a --- /dev/null +++ b/lib/Reporter.ml @@ -0,0 +1,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 \ No newline at end of file |