Allow using top level variables defined in source code in dry-run PARAMETER and STORAGE

This commit is contained in:
Lesenechal Remi 2020-02-19 16:10:50 +01:00
parent 892f813a6c
commit 44ff5d580d
3 changed files with 10 additions and 2 deletions

View File

@ -327,7 +327,7 @@ let dry_run =
let%bind simplified = Compile.Of_source.compile_contract_input storage input v_syntax in
let%bind typed,_ = Compile.Of_simplified.compile_expression ~env ~state simplified in
let%bind mini_c = Compile.Of_typed.compile_expression typed in
let%bind compiled_params = Compile.Of_mini_c.compile_expression mini_c in
let%bind compiled_params = Compile.Of_mini_c.aggregate_and_compile_expression mini_c_prg mini_c in
let%bind args_michelson = Run.evaluate_expression compiled_params.expr compiled_params.expr_ty in
let%bind options = Run.make_dry_run_options {predecessor_timestamp ; amount ; sender ; source } in

View File

@ -1137,3 +1137,8 @@ let%expect_test _ =
{ parameter int ;
storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ;
code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}]
let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "super-counter.mligo" ; "main" ; "test_param" ; "test_storage" ] ;
[%expect {|
( list[] , 3 ) |}]

View File

@ -2,6 +2,9 @@ type action =
| Increment of int
| Decrement of int
let test_param = Increment(1)
let test_storage = 2
let main (ps : action * int) : (operation list * int) =
let storage =
match ps.0 with