dry-run fails with Tezos.self "%entrypoint"
This only fails during dry-run invocations, regular compilation, and on-chain transactions, both work as expected.
Using this sample contract:
test.mligo
type access_parameter =
| EntryA of unit
| EntryB of unit
let entry_A (p, s : unit * unit) : operation list * unit =
let callback : unit contract = Tezos.self "%entryB" in
[Tezos.transaction p 0tez callback], ()
let entry_B (p, s : unit * unit) : operation list * unit =
([] : operation list), ()
let access (action, store : access_parameter * unit) : operation list * unit =
match action with
| EntryA p -> entry_A (p, store)
| EntryB p -> entry_B (p, store)
Compilation works as expected:
ligo compile-contract test.mligo access
{ parameter (or (unit %entryA) (unit %entryB)) ;
storage unit ;
code { DUP ;
SELF %entryB ;
SWAP ;
CAR ;
IF_LEFT
{ DUP ;
DIP { DIP { DUP } ; SWAP ; PUSH mutez 0 } ;
TRANSFER_TOKENS ;
NIL operation ;
SWAP ;
CONS ;
PUSH unit Unit ;
SWAP ;
PAIR ;
DIP { DROP } }
{ PUSH unit Unit ; NIL operation ; PAIR ; DIP { DROP } } ;
DIP { DROP 2 } } }
Dry-runs fail, unexpectedly:
ligo dry-run --syntax cameligo test.mligo access 'EntryA()' '()'
ligo: error parsing program code
Also, when moving Tezos.self to a top-level variable, the result is unchanged.
let callback : unit contract = Tezos.self "%entryB"
...
let entry_A (p, s : unit * unit) : operation list * unit =
[Tezos.transaction p 0tez callback], ()
This was narrowed down to Tezos.self in another contract, where simply omitting that line resolved the issue.
Produced using the Docker image: ligolang/ligo:next, image-id: 2aabe6d4d53a
Edited by Eowyn Dean