summaryrefslogtreecommitdiff
path: root/compiler/InterpreterStatements.ml
diff options
context:
space:
mode:
authorSon HO2024-04-07 15:09:58 +0200
committerGitHub2024-04-07 15:09:58 +0200
commit05164f1ea87b7da14f60e6dbcc718a4f8d639ea1 (patch)
tree7973a53f134c38a856376b6204a7c76900eaafe7 /compiler/InterpreterStatements.ml
parentd8650bfc5c4dc78fda13953dac93c9e6c24489d1 (diff)
parenta9a2f81e365eeef4fd157fb56cd5107f95c91163 (diff)
Merge pull request #113 from AeneasVerif/escherichia/error_catching_translate
Error catching should tell when code couldn't be generated
Diffstat (limited to '')
-rw-r--r--compiler/InterpreterStatements.ml13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/InterpreterStatements.ml b/compiler/InterpreterStatements.ml
index 1cf1c5ef..de89f316 100644
--- a/compiler/InterpreterStatements.ml
+++ b/compiler/InterpreterStatements.ml
@@ -1365,10 +1365,21 @@ and eval_transparent_function_call_symbolic (config : config) (meta : Meta.meta)
let func, generics, trait_method_generics, def, regions_hierarchy, inst_sg =
eval_transparent_function_call_symbolic_inst meta call ctx
in
- (* Sanity check *)
+ (* Sanity check: same number of inputs *)
sanity_check __FILE__ __LINE__
(List.length call.args = List.length def.signature.inputs)
def.meta;
+ (* Sanity check: no nested borrows, borrows in ADTs, etc. *)
+ cassert __FILE__ __LINE__
+ (List.for_all
+ (fun ty -> not (ty_has_nested_borrows ctx.type_ctx.type_infos ty))
+ (inst_sg.output :: inst_sg.inputs))
+ meta "Nested borrows are not supported yet";
+ cassert __FILE__ __LINE__
+ (List.for_all
+ (fun ty -> not (ty_has_adt_with_borrows ctx.type_ctx.type_infos ty))
+ (inst_sg.output :: inst_sg.inputs))
+ meta "ADTs containing borrows are not supported yet";
(* Evaluate the function call *)
eval_function_call_symbolic_from_inst_sig config def.meta func def.signature
regions_hierarchy inst_sg generics trait_method_generics call.args call.dest