From 73b95970460fb7d8c90e2ea97fa6457d7850af07 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 7 Mar 2023 08:51:22 +0100 Subject: Add more checks in Driver.ml --- compiler/Driver.ml | 8 ++++++-- compiler/SymbolicToPure.ml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/Driver.ml b/compiler/Driver.ml index 1dbd611a..149e2aad 100644 --- a/compiler/Driver.ml +++ b/compiler/Driver.ml @@ -134,7 +134,7 @@ let () = match !opt_backend with | Some b -> backend := b | None -> - print_string "Backend not specified (use the `-backend` argument)\n"; + log#error "Backend not specified (use the `-backend` argument)"; fail () in @@ -151,7 +151,11 @@ let () = decompose_nested_let_patterns := true | Lean -> (* The Lean backend is experimental: print a warning *) - log#lwarning (lazy "The Lean backend is experimental") + log#lwarning (lazy "The Lean backend is experimental"); + (* We don't support fuel for the Lean backend *) + if !use_fuel then ( + log#error "The Lean backend doesn't support the -use-fuel option"; + fail ()) in (* Retrieve and check the filename *) diff --git a/compiler/SymbolicToPure.ml b/compiler/SymbolicToPure.ml index f357f33b..2c103177 100644 --- a/compiler/SymbolicToPure.ml +++ b/compiler/SymbolicToPure.ml @@ -2616,7 +2616,8 @@ let wrap_in_match_fuel (fuel0 : VarId.id) (fuel : VarId.id) (body : texpression) let match_e = Switch (fuel0, Match [ fail_branch; success_branch ]) in { e = match_e; ty = match_ty } | Lean -> - failwith "Not handling fuel in Lean" + (* We should have checked the command line arguments before *) + raise (Failure "Unexpected") let translate_fun_decl (ctx : bs_ctx) (body : S.expression option) : fun_decl = (* Translate *) -- cgit v1.2.3