From 5b9f8de676829817d2b776166fda66bfb5128d6c Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 24 Nov 2023 17:10:05 +0100 Subject: Improve the error messages for some name collisions --- compiler/ExtractBase.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ExtractBase.ml b/compiler/ExtractBase.ml index c6158847..dffe1ea3 100644 --- a/compiler/ExtractBase.ml +++ b/compiler/ExtractBase.ml @@ -634,11 +634,13 @@ let id_to_string (id : id) (ctx : extraction_ctx) : string = | TypeId id -> "type name: " ^ type_id_to_string ctx id | StructId id -> "struct constructor of: " ^ type_id_to_string ctx id | VariantId (id, variant_id) -> + let type_name = type_id_to_string ctx id in let variant_name = adt_variant_to_string ctx id (Some variant_id) in - "variant name: " ^ variant_name + "type name: " ^ type_name ^ ", variant name: " ^ variant_name | FieldId (id, field_id) -> + let type_name = type_id_to_string ctx id in let field_name = adt_field_to_string ctx id field_id in - "field name: " ^ field_name + "type name: " ^ type_name ^ ", field name: " ^ field_name | UnknownId -> "keyword" | TypeVarId id -> "type_var_id: " ^ TypeVarId.to_string id | ConstGenericVarId id -> -- cgit v1.2.3