2019-09-22 05:39:06 +04:00
|
|
|
type param is
|
|
|
|
| Zero of nat
|
|
|
|
| Pos of nat
|
|
|
|
|
|
|
|
function main (const p : param; const s : unit) : list(operation) * unit is
|
|
|
|
block {
|
|
|
|
case p of
|
|
|
|
| Zero (n) -> if n > 0n then failwith("fail") else skip
|
|
|
|
| Pos (n) -> if n > 0n then skip else failwith("fail")
|
|
|
|
end
|
|
|
|
}
|
|
|
|
with ((nil : list(operation)), s)
|
2019-09-26 20:47:46 +04:00
|
|
|
|
2019-09-26 21:01:07 +04:00
|
|
|
function foobar (const i : int) : int is
|
2019-09-26 20:47:46 +04:00
|
|
|
var p : param := Zero (42n) ;
|
|
|
|
block {
|
|
|
|
if i > 0 then block {
|
|
|
|
i := i + 1 ;
|
|
|
|
if i > 10 then block {
|
|
|
|
i := 20 ;
|
|
|
|
failwith ("who knows") ;
|
|
|
|
i := 30 ;
|
|
|
|
} else skip
|
|
|
|
} else block {
|
|
|
|
case p of
|
|
|
|
| Zero (n) -> failwith ("wooo")
|
|
|
|
| Pos (n) -> skip
|
|
|
|
end
|
|
|
|
}
|
2019-09-26 21:01:07 +04:00
|
|
|
} with case p of
|
|
|
|
| Zero (n) -> i
|
|
|
|
| Pos (n) -> (failwith ("waaaa") : int)
|
|
|
|
end
|