Merge branch 'dev' of https://gitlab.com/ligolang/ligo into reasonligo-improvemtns

This commit is contained in:
Sander Spies 2019-12-17 14:34:58 +01:00
commit ebba74e7a7
14 changed files with 65 additions and 17 deletions

View File

@ -1,6 +1,9 @@
ARG target
FROM ocaml/opam2:${target}
ARG ci_job_id
ENV CI_JOB_ID=$ci_job_id
RUN opam switch 4.07 && eval $(opam env)
USER root
@ -26,7 +29,7 @@ RUN opam update
# Install ligo
RUN sh scripts/install_vendors_deps.sh
RUN opam install -y ./src
RUN opam install -y .
# Use the ligo binary as a default command
ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ]

View File

@ -858,6 +858,13 @@ a:hover {
}
}
@media (min-width: 1500px) {
.centered {
max-width: 1400px;
}
}
@media (max-width: 1023px) {
.centered {
flex-direction: column;
@ -954,3 +961,4 @@ a:hover {
.language-reasonligo .hljs-constructor {
color: #a31515;
}

View File

@ -8,4 +8,4 @@ dockerfile="./docker/distribution/generic/build.Dockerfile"
echo "Building LIGO for $target"
echo "Using Dockerfile: $dockerfile"
echo "Tagging as: $tag_build\n"
docker build --build-arg target="$target" -t "$tag_build" -f "$dockerfile" .
docker build --build-arg ci_job_id="${CI_JOB_ID}" --build-arg target="$target" -t "$tag_build" -f "$dockerfile" .

View File

@ -14,7 +14,8 @@ then
m4 \
libcap \
bubblewrap \
rsync
rsync \
git
else
apt-get update -qq
@ -27,5 +28,6 @@ else
m4 \
libcap-dev \
bubblewrap \
rsync
rsync \
git
fi

View File

@ -2,5 +2,5 @@
set -e
# Install local dependencies
opam install -y --deps-only --with-test $(find src vendors -name \*.opam)
opam install -y --deps-only --with-test ./ligo.opam $(find vendors -name \*.opam)
opam install -y $(find vendors -name \*.opam)

View File

@ -2,5 +2,5 @@
set -e
set -x
printf '' | opam switch create . ocaml-base-compiler.4.07.1 # toto ocaml-base-compiler.4.06.1
printf '' | opam switch create . ocaml-base-compiler.4.07.1 --no-install
eval $(opam config env)

View File

@ -899,3 +899,16 @@ let%expect_test _ =
PAIR ;
DIP { DROP 5 } } ;
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

@ -920,8 +920,9 @@ module Compiler = struct
| C_UNIT -> ok @@ simple_constant @@ prim I_UNIT
| C_BALANCE -> ok @@ simple_constant @@ prim I_BALANCE
| 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_IMPLICIT_ACCOUNT -> ok @@ simple_unary @@ prim I_IMPLICIT_ACCOUNT
| C_NOW -> ok @@ simple_constant @@ prim I_NOW
| C_CALL -> ok @@ simple_ternary @@ prim I_TRANSFER_TOKENS
| C_SOURCE -> ok @@ simple_constant @@ prim I_SOURCE

View File

@ -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)

View File

@ -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

View File

@ -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) ;
};

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)

View File

@ -1624,17 +1624,26 @@ let balance_constant_religo () : unit result =
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%bind _ = type_file "./contracts/address.ligo" in
ok ()
let%bind program = type_file "./contracts/address.ligo" in
addr_test program
let address_mligo () : unit result =
let%bind _ = mtype_file "./contracts/address.mligo" in
ok ()
let%bind program = mtype_file "./contracts/address.mligo" in
addr_test program
let address_religo () : unit result =
let%bind _ = retype_file "./contracts/address.religo" in
ok ()
let%bind program = retype_file "./contracts/address.religo" in
addr_test program
let self_address () : unit result =