Skip to content

Commit

Permalink
Read .gospel files in qcheck-stm plugin
Browse files Browse the repository at this point in the history
This commit also modifies how we handle xpost in the case of exception
that doesn't take any argument as it was not working anymore (but I
don't know why exactly).
  • Loading branch information
n-osborne committed Jul 1, 2024
1 parent e9e8f0e commit bb5b4a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugins/qcheck-stm/src/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ let init gospel config_module =
let open Reserr in
try
let module_name = Utils.module_name_of_path gospel
and env, sigs = Utils.type_check [] gospel in
and env, sigs =
match Filename.extension gospel with
| ".mli" -> Utils.type_check [] gospel
| ".gospel" -> Utils.read_gospel_file gospel
| _ -> invalid_arg "init"
in
assert (List.length env = 1);
let namespace = List.hd env in
let context = Context.init module_name namespace in
Expand Down
3 changes: 2 additions & 1 deletion plugins/qcheck-stm/src/ir_of_gospel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ let postcond spec =
(fun (p, t) ->
let open Tterm in
match p.p_node with
| Papp (ls, []) when Symbols.(ls_equal ls (fs_tuple 0)) ->
(* When the exception doesn't take any argument, gospel type-checker add a dummy pattern here *)
| Papp (_, []) when Ttypes.(x.xs_type = Exn_tuple []) ->
(x, None, Ir.term_val spec t)
| _ -> (x, Some p, Ir.term_val spec t))
l)
Expand Down

0 comments on commit bb5b4a6

Please sign in to comment.