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 Mar 26, 2024
1 parent 0f63107 commit 003676c
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 @@ -79,7 +79,12 @@ let init path init_sut_txt sut_str =
let open Reserr in
try
let module_name = Utils.module_name_of_path path
and env, sigs = Utils.type_check [] path in
and env, sigs =
match Filename.extension path with
| ".mli" -> Utils.type_check [] path
| ".gospel" -> Utils.read_gospel_file path
| _ -> 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 @@ -207,7 +207,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 003676c

Please sign in to comment.