From 03dd86c9ad3f6ce4628d1e069cc7cdf309f3817b Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 29 Nov 2019 02:54:52 -0800 Subject: [PATCH] Expose address operator in PascaLIGO and CameLIGO --- src/passes/operators/operators.ml | 2 ++ src/test/contracts/address.ligo | 1 + src/test/contracts/address.mligo | 1 + src/test/integration_tests.ml | 10 ++++++++++ 4 files changed, 14 insertions(+) create mode 100644 src/test/contracts/address.ligo create mode 100644 src/test/contracts/address.mligo diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index b6f2a0d89..52b799ac3 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -73,6 +73,7 @@ module Simplify = struct ("unit" , "UNIT") ; ("source" , "SOURCE") ; ("sender" , "SENDER") ; + ("address", "ADDRESS") ; ("implicit_account", "IMPLICIT_ACCOUNT") ; ("failwith" , "FAILWITH") ; ("bitwise_or" , "OR") ; @@ -137,6 +138,7 @@ module Simplify = struct ("gas", "STEPS_TO_QUOTA") ; ("Current.sender" , "SENDER") ; ("sender", "SENDER") ; + ("Current.address", "ADDRESS") ; ("Current.implicit_account", "IMPLICIT_ACCOUNT") ; ("Current.source" , "SOURCE") ; ("source", "SOURCE") ; diff --git a/src/test/contracts/address.ligo b/src/test/contracts/address.ligo new file mode 100644 index 000000000..555ab6fe7 --- /dev/null +++ b/src/test/contracts/address.ligo @@ -0,0 +1 @@ +function main (const c: contract(unit)) : address is address(c) diff --git a/src/test/contracts/address.mligo b/src/test/contracts/address.mligo new file mode 100644 index 000000000..efca3d8b8 --- /dev/null +++ b/src/test/contracts/address.mligo @@ -0,0 +1 @@ +let main (c: unit contract) : address = Current.address c diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 53ed9c98c..d4127bb60 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1233,6 +1233,14 @@ let balance_constant_mligo () : unit result = let expected = e_tuple [e_list []; e_mutez 4000000000000] in expect_eq program "main" input expected +let address () : unit result = + let%bind _ = type_file "./contracts/address.ligo" in + ok () + +let address_mligo () : unit result = + let%bind _ = mtype_file "./contracts/address.mligo" in + ok () + let implicit_account () : unit result = let%bind _ = type_file "./contracts/implicit_account.ligo" in ok () @@ -1406,6 +1414,8 @@ let main = test_suite "Integration (End to End)" [ test "let multiple (mligo)" mligo_let_multiple ; test "balance constant" balance_constant ; test "balance constant (mligo)" balance_constant_mligo ; + test "address" address ; + test "address_mligo" address_mligo ; test "implicit account" implicit_account ; test "implicit account (mligo)" implicit_account_mligo ; test "is_nat" is_nat ;