fix dispatch error

This commit is contained in:
Galfour 2019-05-07 14:59:12 +00:00
parent 1e9760bb07
commit f47d32de2e
4 changed files with 23 additions and 12 deletions

View File

@ -72,12 +72,9 @@ let compile_contract_file : string -> string -> string result = fun source entry
let%bind typed =
trace (simple_error "typing") @@
Typer.type_program simplified in
let%bind main_typed =
trace (simple_error "getting typed main") @@
Ast_typed.program_to_main typed entry_point in
let%bind mini_c =
trace (simple_error "transpiling") @@
Transpiler.translate_main main_typed in
Transpiler.translate_entry typed entry_point in
let%bind michelson =
trace (simple_error "compiling") @@
Compiler.translate_contract mini_c in

View File

@ -0,0 +1,13 @@
open Trace
open Ligo
open Test_helpers
let compile_contract_basic () : unit result =
let%bind _ =
Contract.compile_contract_file "./contracts/dispatch-counter.ligo" "main"
in
ok ()
let main = "Bin", [
test "compile contract basic" compile_contract_basic ;
]

View File

@ -70,14 +70,14 @@ let higher_order () : unit result =
let shared_function () : unit result =
let%bind program = type_file "./contracts/function-shared.ligo" in
(* let%bind () =
* let make_expect = fun n -> (n + 1) in
* expect_eq_n_int program "inc" make_expect
* in
* let%bind () =
* let make_expect = fun n -> (n + 2) in
* expect_eq_n_int program "double_inc" make_expect
* in *)
let%bind () =
let make_expect = fun n -> (n + 1) in
expect_eq_n_int program "inc" make_expect
in
let%bind () =
let make_expect = fun n -> (n + 2) in
expect_eq_n_int program "double_inc" make_expect
in
let%bind () =
let make_expect = fun n -> (2 * n + 3) in
expect_eq program "foo" (e_a_int 0) (e_a_int @@ make_expect 0)

View File

@ -10,5 +10,6 @@ let () =
Typer_tests.main ;
Heap_tests.main ;
Coase_tests.main ;
Bin_tests.main ;
] ;
()