From 7cb0914c68a055a308539ccc781fea8f30ef27bb Mon Sep 17 00:00:00 2001 From: Son Ho Date: Wed, 5 Jun 2024 17:03:57 +0200 Subject: Update an error message --- compiler/InterpreterPaths.ml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'compiler') diff --git a/compiler/InterpreterPaths.ml b/compiler/InterpreterPaths.ml index 8a924a0a..992146de 100644 --- a/compiler/InterpreterPaths.ml +++ b/compiler/InterpreterPaths.ml @@ -250,12 +250,16 @@ let rec access_projection (span : Meta.span) (access : projection_access) Ok (ctx, { res with updated = nv }) else Error (FailSharedLoan bids)) | (_, (VLiteral _ | VAdt _ | VBottom | VBorrow _), _) as r -> - let pe, v, ty = r in - let pe = "- pe: " ^ show_projection_elem pe in - let v = "- v:\n" ^ show_value v in - let ty = "- ty:\n" ^ show_ety ty in - craise __FILE__ __LINE__ span - ("Inconsistent projection:\n" ^ pe ^ "\n" ^ v ^ "\n" ^ ty)) + if v.value = VBottom then + craise __FILE__ __LINE__ span + "Can not apply a projection to the ⊥ value" + else + let pe, v, ty = r in + let pe = "- pe: " ^ show_projection_elem pe in + let v = "- v:\n" ^ show_value v in + let ty = "- ty:\n" ^ show_ety ty in + craise __FILE__ __LINE__ span + ("Inconsistent projection:\n" ^ pe ^ "\n" ^ v ^ "\n" ^ ty)) (** Generic function to access (read/write) the value at a given place. -- cgit v1.2.3