From 8d40541003736d5319ec981278338e8c8c66daf6 Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Sun, 23 Jun 2024 01:36:48 +0200 Subject: keep track of bound names everywhere to be able to output names instead of de bruijn indices --- lib/Reporter.ml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/Reporter.ml') diff --git a/lib/Reporter.ml b/lib/Reporter.ml index c86a04a..a90966c 100644 --- a/lib/Reporter.ml +++ b/lib/Reporter.ml @@ -1,10 +1,11 @@ module Message = struct - type t = + type t = | SyntaxError | IllTyped | UnboundVariable | CannotInferType + | Bug let default_severity : t -> Asai.Diagnostic.severity = function @@ -12,17 +13,20 @@ struct | IllTyped -> Error | UnboundVariable -> Error | CannotInferType -> Error + | Bug -> Bug let short_code : t -> string = function - | SyntaxError -> "E0001" - | IllTyped -> "E0002" - | UnboundVariable -> "E0003" - | CannotInferType -> "E0004" + | SyntaxError -> "E001" + | IllTyped -> "E002" + | UnboundVariable -> "E003" + | CannotInferType -> "E004" + | Bug -> "BUG" 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 unbound_variable id = fatalf UnboundVariable "unbound variable %a" Ident.pp id +let expected_universe fmt x = fatalf IllTyped "expected a universe but got %a" fmt x -let expected_universe fmt x = fatalf IllTyped "expected a universe but got %a" fmt x \ No newline at end of file +let bug msg = fatalf Bug msg -- cgit 1.4.1