type failwith
This commit is contained in:
parent
e0e5228254
commit
08809f8a5d
@ -312,11 +312,12 @@ module Typer = struct
|
|||||||
then ok @@ t_bytes ()
|
then ok @@ t_bytes ()
|
||||||
else simple_fail "bad slice"
|
else simple_fail "bad slice"
|
||||||
|
|
||||||
let failwith_ = typer_1 "FAILWITH" @@ fun t ->
|
let failwith_ = typer_1_opt "FAILWITH" @@ fun t opt ->
|
||||||
let%bind () =
|
let%bind () =
|
||||||
Assert.assert_true @@
|
Assert.assert_true @@
|
||||||
(is_t_string t) in
|
(is_t_string t) in
|
||||||
ok @@ t_unit ()
|
let default = t_unit () in
|
||||||
|
ok @@ Simple_utils.Option.unopt ~default opt
|
||||||
|
|
||||||
let map_get_force = typer_2 "MAP_GET_FORCE" @@ fun i m ->
|
let map_get_force = typer_2 "MAP_GET_FORCE" @@ fun i m ->
|
||||||
let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in
|
let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in
|
||||||
|
@ -11,7 +11,7 @@ function main (const p : param; const s : unit) : list(operation) * unit is
|
|||||||
}
|
}
|
||||||
with ((nil : list(operation)), s)
|
with ((nil : list(operation)), s)
|
||||||
|
|
||||||
function foobar (const i : int) : unit is
|
function foobar (const i : int) : int is
|
||||||
var p : param := Zero (42n) ;
|
var p : param := Zero (42n) ;
|
||||||
block {
|
block {
|
||||||
if i > 0 then block {
|
if i > 0 then block {
|
||||||
@ -27,4 +27,7 @@ function foobar (const i : int) : unit is
|
|||||||
| Pos (n) -> skip
|
| Pos (n) -> skip
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
} with unit
|
} with case p of
|
||||||
|
| Zero (n) -> i
|
||||||
|
| Pos (n) -> (failwith ("waaaa") : int)
|
||||||
|
end
|
||||||
|
@ -652,10 +652,10 @@ let failwith_ligo () : unit result =
|
|||||||
let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in
|
let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in
|
||||||
let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in
|
let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in
|
||||||
let should_fail input = expect_fail program "foobar" (e_int input) in
|
let should_fail input = expect_fail program "foobar" (e_int input) in
|
||||||
let should_work input = expect_eq program "foobar" (e_int input) (e_unit ()) in
|
let should_work input n = expect_eq program "foobar" (e_int input) (e_int n) in
|
||||||
let%bind () = should_fail @@ 10 in
|
let%bind () = should_fail 10 in
|
||||||
let%bind () = should_fail @@ -10 in
|
let%bind () = should_fail @@ -10 in
|
||||||
let%bind () = should_work @@ 5 in
|
let%bind () = should_work 5 6 in
|
||||||
ok ()
|
ok ()
|
||||||
|
|
||||||
let failwith_mligo () : unit result =
|
let failwith_mligo () : unit result =
|
||||||
|
Loading…
Reference in New Issue
Block a user