summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSon Ho2024-05-24 08:06:44 +0200
committerSon Ho2024-05-24 08:06:44 +0200
commitf37e029fd7ec7dce9410f4baaaad9d09f934de57 (patch)
treef185022d1c19ca41c15b2ac595ec98ddf06c3f10 /compiler
parent0b463547ddc409c885859a8bdb577746d87260a2 (diff)
Fix a crash which happens when type definitions are ignored
Diffstat (limited to '')
-rw-r--r--compiler/Translate.ml7
1 files 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.