Fix IMPLICIT_ACCOUNT, again and this time add regression expect test

This commit is contained in:
John David Pressman 2019-12-16 12:10:31 -08:00
parent dc9747610a
commit fb8fae05d7
3 changed files with 17 additions and 0 deletions

View File

@ -899,3 +899,16 @@ let%expect_test _ =
PAIR ; PAIR ;
DIP { DROP 5 } } ; DIP { DROP 5 } } ;
DIP { DROP } } } |}] DIP { DROP } } } |}]
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "implicit.mligo" ; "main" ] ;
[%expect {|
{ parameter key_hash ;
storage unit ;
code { DUP ;
CAR ;
IMPLICIT_ACCOUNT ;
UNIT ;
NIL operation ;
PAIR ;
DIP { DROP 2 } } } |}]

View File

@ -922,6 +922,7 @@ module Compiler = struct
| C_AMOUNT -> ok @@ simple_constant @@ prim I_AMOUNT | C_AMOUNT -> ok @@ simple_constant @@ prim I_AMOUNT
| C_ADDRESS -> ok @@ simple_constant @@ prim I_ADDRESS | C_ADDRESS -> ok @@ simple_constant @@ prim I_ADDRESS
| C_SELF_ADDRESS -> ok @@ simple_constant @@ seq [prim I_SELF; prim I_ADDRESS] | C_SELF_ADDRESS -> ok @@ simple_constant @@ seq [prim I_SELF; prim I_ADDRESS]
| C_IMPLICIT_ACCOUNT -> ok @@ simple_unary @@ prim I_IMPLICIT_ACCOUNT
| C_NOW -> ok @@ simple_constant @@ prim I_NOW | C_NOW -> ok @@ simple_constant @@ prim I_NOW
| C_CALL -> ok @@ simple_ternary @@ prim I_TRANSFER_TOKENS | C_CALL -> ok @@ simple_ternary @@ prim I_TRANSFER_TOKENS
| C_SOURCE -> ok @@ simple_constant @@ prim I_SOURCE | C_SOURCE -> ok @@ simple_constant @@ prim I_SOURCE

View File

@ -0,0 +1,3 @@
let main (p : key_hash) (s : unit) =
let c : unit contract = Current.implicit_account p in
(([] : operation list), unit)