Merge branch '89-current-address-does-not-compile' into 'dev'
Resolve "Current.address does not compile" Closes #89 See merge request ligolang/ligo!265
This commit is contained in:
commit
362bb1edb9
@ -920,7 +920,7 @@ module Compiler = struct
|
|||||||
| C_UNIT -> ok @@ simple_constant @@ prim I_UNIT
|
| C_UNIT -> ok @@ simple_constant @@ prim I_UNIT
|
||||||
| C_BALANCE -> ok @@ simple_constant @@ prim I_BALANCE
|
| C_BALANCE -> ok @@ simple_constant @@ prim I_BALANCE
|
||||||
| 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_unary @@ 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_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
|
||||||
|
@ -1 +1,5 @@
|
|||||||
function main (const c: contract(unit)) : address is address(c)
|
// function main (const c: contract(unit)) : address is address(c)
|
||||||
|
|
||||||
|
function main (const p : key_hash) : address is block {
|
||||||
|
const c : contract(unit) = implicit_account(p) ;
|
||||||
|
} with address(c)
|
@ -1 +1,3 @@
|
|||||||
let main (c: unit contract) : address = Current.address c
|
let main (p : key_hash) =
|
||||||
|
let c : unit contract = Current.implicit_account p in
|
||||||
|
Current.address c
|
@ -1 +1,4 @@
|
|||||||
let main = (c: contract(unit)): address => Current.address(c);
|
let main = (p : key_hash) : address => {
|
||||||
|
let c : contract(unit) = Current.implicit_account(p) ;
|
||||||
|
Current.address(c) ;
|
||||||
|
};
|
||||||
|
@ -1624,17 +1624,26 @@ let balance_constant_religo () : unit result =
|
|||||||
expect_eq program "main" input expected
|
expect_eq program "main" input expected
|
||||||
|
|
||||||
|
|
||||||
|
let addr_test program =
|
||||||
|
let open Proto_alpha_utils.Memory_proto_alpha in
|
||||||
|
let addr = Protocol.Alpha_context.Contract.to_b58check @@
|
||||||
|
(List.nth dummy_environment.identities 0).implicit_contract in
|
||||||
|
let open Tezos_crypto in
|
||||||
|
let key_hash = Signature.Public_key_hash.to_b58check @@
|
||||||
|
(List.nth dummy_environment.identities 0).public_key_hash in
|
||||||
|
expect_eq program "main" (e_key_hash key_hash) (e_address addr)
|
||||||
|
|
||||||
let address () : unit result =
|
let address () : unit result =
|
||||||
let%bind _ = type_file "./contracts/address.ligo" in
|
let%bind program = type_file "./contracts/address.ligo" in
|
||||||
ok ()
|
addr_test program
|
||||||
|
|
||||||
let address_mligo () : unit result =
|
let address_mligo () : unit result =
|
||||||
let%bind _ = mtype_file "./contracts/address.mligo" in
|
let%bind program = mtype_file "./contracts/address.mligo" in
|
||||||
ok ()
|
addr_test program
|
||||||
|
|
||||||
let address_religo () : unit result =
|
let address_religo () : unit result =
|
||||||
let%bind _ = retype_file "./contracts/address.religo" in
|
let%bind program = retype_file "./contracts/address.religo" in
|
||||||
ok ()
|
addr_test program
|
||||||
|
|
||||||
|
|
||||||
let self_address () : unit result =
|
let self_address () : unit result =
|
||||||
|
Loading…
Reference in New Issue
Block a user