From ff60aee5ef40dca184ed1f8dc058b2dbfbf5cd7a Mon Sep 17 00:00:00 2001 From: Louis Gesbert Date: Thu, 31 Aug 2023 10:41:57 +0200 Subject: [PATCH] Improve module error messages --- compiler/desugared/from_surface.ml | 6 +++--- compiler/desugared/name_resolution.ml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/desugared/from_surface.ml b/compiler/desugared/from_surface.ml index 28f63c62..d62d2eb7 100644 --- a/compiler/desugared/from_surface.ml +++ b/compiler/desugared/from_surface.ml @@ -172,8 +172,8 @@ let rec disambiguate_constructor let modname = ModuleName.of_string modname in match ModuleName.Map.find_opt modname ctxt.modules with | None -> - Message.raise_spanned_error mpos "Module %a not found" ModuleName.format - modname + Message.raise_spanned_error mpos "Module \"%a\" not found" + ModuleName.format modname | Some ctxt -> let constructor = List.map (Mark.map (fun (_, c) -> path, c)) constructor0 @@ -419,7 +419,7 @@ let rec translate_expr let modname = ModuleName.of_string modname in match ModuleName.Map.find_opt modname ctxt.modules with | None -> - Message.raise_spanned_error mpos "Module %a not found" + Message.raise_spanned_error mpos "Module \"%a\" not found" ModuleName.format modname | Some ctxt -> get_str ctxt path) in diff --git a/compiler/desugared/name_resolution.ml b/compiler/desugared/name_resolution.ml index bf71a951..1bad5566 100644 --- a/compiler/desugared/name_resolution.ml +++ b/compiler/desugared/name_resolution.ml @@ -258,8 +258,8 @@ let rec module_ctx ctxt path = let modname = ModuleName.of_string modname in match ModuleName.Map.find_opt modname ctxt.modules with | None -> - Message.raise_spanned_error mpos "Module %a not found" ModuleName.format - modname + Message.raise_spanned_error mpos "Module \"%a\" not found" + ModuleName.format modname | Some ctxt -> module_ctx ctxt path) (** {1 Declarations pass} *)