diff --git a/src/bin/cli_helpers.ml b/src/bin/cli_helpers.ml index ee757ffba..7057e0975 100644 --- a/src/bin/cli_helpers.ml +++ b/src/bin/cli_helpers.ml @@ -10,7 +10,7 @@ let toplevel ~(display_format : string) (x : string result) = ) in match x with - | Ok _ -> Format.printf "%a" (formatted_string_result_pp display_format) x + | Ok _ -> Format.printf "%a\n%!" (formatted_string_result_pp display_format) x | Error _ -> - Format.eprintf "%a" (formatted_string_result_pp display_format) x ; + Format.eprintf "%a\n%!" (formatted_string_result_pp display_format) x ; exit 1 diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 6568b2863..ceb17f17a 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -703,6 +703,7 @@ module Compiler = struct ("MAP_UPDATE" , simple_ternary @@ prim I_UPDATE) ; ("SIZE" , simple_unary @@ prim I_SIZE) ; ("FAILWITH" , simple_unary @@ prim I_FAILWITH) ; + ("ASSERT_INFERRED" , simple_binary @@ i_if (seq [i_failwith]) (seq [i_drop ; i_push_unit])) ; ("ASSERT" , simple_unary @@ i_if (seq [i_push_unit]) (seq [i_push_unit ; i_failwith])) ; ("INT" , simple_unary @@ prim I_INT) ; ("ABS" , simple_unary @@ prim I_ABS) ; diff --git a/src/test/contracts/coase.ligo b/src/test/contracts/coase.ligo index b1f1da4a4..ea7f9d057 100644 --- a/src/test/contracts/coase.ligo +++ b/src/test/contracts/coase.ligo @@ -41,7 +41,7 @@ function transfer_single(const action : action_transfer_single ; const s : stora begin const cards : cards = s.cards ; const card : card = get_force(action.card_to_transfer , cards) ; - if (card.card_owner =/= source) then failwith("This card doesn't belong to you") else skip ; + if (card.card_owner =/= source) then fail "This card doesn't belong to you" else skip ; card.card_owner := action.destination ; cards[action.card_to_transfer] := card ; s.cards := cards ; @@ -51,7 +51,7 @@ function transfer_single(const action : action_transfer_single ; const s : stora function sell_single(const action : action_sell_single ; const s : storage_type) : (list(operation) * storage_type) is begin const card : card = get_force(action.card_to_sell , s.cards) ; - if (card.card_owner =/= source) then failwith("This card doesn't belong to you") else skip ; + if (card.card_owner =/= source) then fail "This card doesn't belong to you" else skip ; const card_pattern : card_pattern = get_force(card.card_pattern , s.card_patterns) ; card_pattern.quantity := abs(card_pattern.quantity - 1n); const card_patterns : card_patterns = s.card_patterns ; @@ -71,7 +71,7 @@ function buy_single(const action : action_buy_single ; const s : storage_type) : // Check funds const card_pattern : card_pattern = get_force(action.card_to_buy , s.card_patterns) ; const price : tez = card_pattern.coefficient * (card_pattern.quantity + 1n) ; - if (price > amount) then failwith("Not enough money") else skip ; + if (price > amount) then fail "Not enough money" else skip ; // Administrative procedure const operations : list(operation) = nil ; // Increase quantity