summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2023-05-15 13:18:30 +0200
committerSon HO2023-06-04 21:44:33 +0200
commitefb0cd6eafbb25a51bba64ac613d910dcec4cfe7 (patch)
treec09892fdc0e1ace07c71f15b56048339d7016860
parent72d35d4ce84a863bb4d96b844fb552028d94234a (diff)
Add a sanity check in Driver.ml
Diffstat (limited to '')
-rw-r--r--compiler/Driver.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/Driver.ml b/compiler/Driver.ml
index 12a6f075..d8418278 100644
--- a/compiler/Driver.ml
+++ b/compiler/Driver.ml
@@ -211,6 +211,19 @@ let () =
functions";
fail ());
+ (* We don't support mutually recursive definitions with decreases clauses in Lean *)
+ if
+ !backend = Lean && !extract_decreases_clauses
+ && List.exists
+ (function Aeneas.LlbcAst.Fun (Rec (_ :: _)) -> true | _ -> false)
+ m.declarations
+ then (
+ log#error
+ "The Lean backend doesn't support the use of \
+ decreasing_by/termination_by clauses with mutually recursive \
+ definitions";
+ fail ());
+
(* Apply the pre-passes *)
let m = PrePasses.apply_passes m in