Commit efe64191 authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

programs: fixed bug in WP for try/with

parent 4e3e29cd
...@@ -1012,8 +1012,11 @@ and expr_desc gl env loc ty = function ...@@ -1012,8 +1012,11 @@ and expr_desc gl env loc ty = function
in in
x, v, expr gl env h x, v, expr gl env h
in in
let hl = List.map handler hl in
let ef = List.fold_left (fun e (x,_,_) -> E.remove_raise x e) ef hl in let ef = List.fold_left (fun e (x,_,_) -> E.remove_raise x e) ef hl in
let hl = List.map handler hl in
let ef =
List.fold_left (fun e (_,_,h) -> E.union e h.expr_effect) ef hl
in
Etry (e1, hl), tpure ty, ef Etry (e1, hl), tpure ty, ef
| IEassert (k, f) -> | IEassert (k, f) ->
......
...@@ -24,3 +24,5 @@ val debug : Debug.flag ...@@ -24,3 +24,5 @@ val debug : Debug.flag
val decl : val decl :
Env.env -> Pgm_env.env -> Pgm_ptree.decl -> Pgm_env.env * Pgm_ttree.decl list Env.env -> Pgm_env.env -> Pgm_ptree.decl -> Pgm_env.env * Pgm_ttree.decl list
val print_post : Format.formatter -> Pgm_ttree.post -> unit
...@@ -197,7 +197,7 @@ let default_post ty ef = ...@@ -197,7 +197,7 @@ let default_post ty ef =
List.map default_exn_post (Sls.elements ef.E.raises) List.map default_exn_post (Sls.elements ef.E.raises)
let rec assoc_handler x = function let rec assoc_handler x = function
| [] -> assert false | [] -> raise Not_found
| (y, h) :: _ when ls_equal x y -> h | (y, h) :: _ when ls_equal x y -> h
| _ :: hl -> assoc_handler x hl | _ :: hl -> assoc_handler x hl
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
(* test file *) (* test file *)
theory Test theory Test
use import int.Int
logic (*) int int type t = tuple2 int int
goal G : not 1=2 and 3=4
end end
......
exception Break
{ let f (n : int) : int =
} { true }
let i = ref n in
let f x = try
{} while (!i > 0) do
if x = 1 then invariant { true }
1 variant { !i }
else if (!i <= 10) then raise Break;
if x = 2 then i := !i - 1
2 done
else with Break -> ()
3 end;
{ x = 1 !i
or (not x = 1 and x = 2) { result <= 10 }
or (not x = 1 and not x = 2 and result = 3) }
(* (*
Local Variables: Local Variables:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment