From f37e029fd7ec7dce9410f4baaaad9d09f934de57 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 24 May 2024 08:06:44 +0200 Subject: Fix a crash which happens when type definitions are ignored --- compiler/Translate.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/Translate.ml b/compiler/Translate.ml index 0f6aa7c1..60ae99f9 100644 --- a/compiler/Translate.ml +++ b/compiler/Translate.ml @@ -417,9 +417,12 @@ let export_types_group (fmt : Format.formatter) (config : gen_config) else ExtractBase.MutRecInner in - (* Retrieve the declarations *) + (* Retrieve the declarations - note that some of them might have been ignored in + case of errors *) let defs = - List.map (fun id -> Pure.TypeDeclId.Map.find id ctx.trans_types) ids + List.filter_map + (fun id -> Pure.TypeDeclId.Map.find_opt id ctx.trans_types) + ids in (* Check if the definition are builtin - if yes they must be ignored. -- cgit v1.2.3