From 0895467f748a4d92dcd800b9ea178cda362742fa Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Sat, 11 Jan 2020 19:37:38 -0600 Subject: [PATCH] Less dippy application --- src/bin/expect_tests/contract_tests.ml | 13 ++++++++----- src/passes/12-compiler/compiler_program.ml | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index af6a644d7..cb8491ee3 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -10,10 +10,10 @@ let%expect_test _ = [%expect {| 1874 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ; - [%expect {| 1163 bytes |}] ; + [%expect {| 1169 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ; - [%expect {| 2867 bytes |}] ; + [%expect {| 2862 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ; [%expect {| 617 bytes |}] ; @@ -431,9 +431,10 @@ let%expect_test _ = DIP { DUP } ; SWAP ; DIP { DROP 4 } } ; - DIP { DUP } ; - SWAP ; UNIT ; + DIP 2 { DUP } ; + DIG 2 ; + SWAP ; EXEC ; DIP { DUP } ; PAIR ; @@ -621,7 +622,9 @@ let%expect_test _ = CDR ; CAR ; CDR ; - DIP { DIP 12 { DUP } ; DIG 12 } ; + DIP 13 { DUP } ; + DIG 13 ; + SWAP ; EXEC ; DIP { DUP } ; SWAP ; diff --git a/src/passes/12-compiler/compiler_program.ml b/src/passes/12-compiler/compiler_program.ml index 200bd0cf9..e19e2075e 100644 --- a/src/passes/12-compiler/compiler_program.ml +++ b/src/passes/12-compiler/compiler_program.ml @@ -251,11 +251,12 @@ and translate_expression (expr:expression) (env:environment) : michelson result ) | E_application (f , arg) -> ( trace (simple_error "Compiling quote application") @@ - let%bind f = translate_expression f env in + let%bind f = translate_expression f (Environment.add (Var.fresh (), arg.type_value) env) in let%bind arg = translate_expression arg env in return @@ seq [ arg ; - dip f ; + f ; + i_swap ; prim I_EXEC ; ] )