about summary refs log tree commit diff
path: root/lib/Reporter.ml
diff options
context:
space:
mode:
authorMalte Voos <git@mal.tc>2024-06-23 01:36:48 +0200
committerMalte Voos <git@mal.tc>2024-06-23 01:36:48 +0200
commit8d40541003736d5319ec981278338e8c8c66daf6 (patch)
treee595d0055af42b6a9d84e504befbe114a8cef5e2 /lib/Reporter.ml
parent36762e83887b6f917df46c5e40a11d53b697209d (diff)
downloadtoytt-8d40541003736d5319ec981278338e8c8c66daf6.tar.gz
toytt-8d40541003736d5319ec981278338e8c8c66daf6.zip
keep track of bound names everywhere to be able to output names instead of de bruijn indices
Diffstat (limited to 'lib/Reporter.ml')
-rw-r--r--lib/Reporter.ml18
1 files changed, 11 insertions, 7 deletions
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