@@ -454,14 +454,15 @@ struct
454454 | `Lifted c_inv ->
455455 (* Collect all start states that may satisfy the invariant of current_c *)
456456 List. iter (fun c ->
457- let x = R. ask_local (c.node, c.context) ~local: c.state ( Queries. EvalInt c_inv) in (* TODO: Queries.eval_bool? *)
458- if Queries.ID. is_bot x || Queries.ID. is_bot_ikind x then (* dead code *)
457+ match Queries. eval_bool {f = ( fun ( type a ) ( q : a Queries.t ) -> R. ask_local (c.node, c.context) ~local: c.state q)} c_inv with
458+ | `Bot -> (* dead code *)
459459 failwith " Bottom not expected when querying context state" (* Maybe this is reachable, failwith for now so we see when this happens *)
460- else if Queries.ID. to_bool x = Some false then () (* Nothing to do, the c does definitely not satisfy the predicate of current_c *)
461- else begin
460+ | `Lifted false ->
461+ () (* Nothing to do, the c does definitely not satisfy the predicate of current_c *)
462+ | `Lifted true
463+ | `Top ->
462464 (* Insert c into the list of weaker contexts of f *)
463- FCMap. modify_def [] (f, current_c.context) (fun cs -> c::cs) fc_map;
464- end
465+ FCMap. modify_def [] (f, current_c.context) (fun cs -> c::cs) fc_map
465466 ) con_invs;
466467 | `Bot | `Top ->
467468 (* If the context invariant is None, we will not generate a precondition invariant. Nothing to do here. *)
@@ -747,15 +748,12 @@ struct
747748
748749 let result: VR. result = match InvariantParser. parse_cil inv_parser ~fundec ~loc inv_cabs with
749750 | Ok inv_exp ->
750- let x = ask_local lvar (Queries. EvalInt inv_exp) in (* TODO: Queries.eval_bool? *)
751- if Queries.ID. is_bot x || Queries.ID. is_bot_ikind x then (* dead code *)
752- Option. get (VR. result_of_enum (VR. bot () ))
753- else (
754- match Queries.ID. to_bool x with
755- | Some true -> Confirmed
756- | Some false -> Refuted
757- | None -> Unconfirmed
758- )
751+ begin match Queries. eval_bool {f = (fun (type a ) (q : a Queries.t ) -> ask_local lvar q)} inv_exp with
752+ | `Bot -> Option. get (VR. result_of_enum (VR. bot () )) (* dead code *)
753+ | `Lifted true -> Confirmed
754+ | `Lifted false -> Refuted
755+ | `Top -> Unconfirmed
756+ end
759757 | Error e ->
760758 ParseError
761759 in
@@ -859,14 +857,11 @@ struct
859857
860858 match InvariantParser. parse_cil inv_parser ~fundec ~loc pre_cabs with
861859 | Ok pre_exp ->
862- let x = ask_local pre_lvar (Queries. EvalInt pre_exp) in (* TODO: Queries.eval_bool? *)
863- if Queries.ID. is_bot x || Queries.ID. is_bot_ikind x then (* dead code *)
864- true
865- else (
866- match Queries.ID. to_bool x with
867- | Some b -> b
868- | None -> false
869- )
860+ begin match Queries. eval_bool {f = (fun (type a ) (q : a Queries.t ) -> ask_local pre_lvar q)} pre_exp with
861+ | `Bot -> true (* dead code *)
862+ | `Lifted b -> b
863+ | `Top -> false
864+ end
870865 | Error e ->
871866 M. error ~category: Witness ~loc: msgLoc " CIL couldn't parse precondition: %s" pre;
872867 M. info ~category: Witness ~loc: msgLoc " precondition has undefined variables or side effects: %s" pre;
0 commit comments