The passes unused
(for finding unused bindings) & muchused
(for checking linearity for tickets) did not decend into the declarations of E_mod_in
(location module in an expression).
Which caused unnecessary unused warnings for binding & no warnings in duplicate tickets.
Fixes #1672 (closed)
This MR fixes these issues.
let fst (x, _) = x
let snd (_, x) = x
let main (_ : unit * nat ticket) : operation list * nat ticket =
let n = 10n in
module B = struct
let ticket = Option.unopt (Tezos.create_ticket n n)
let y = ticket, ticket
end in
[], Option.unopt (Tezos.join_tickets (fst B.y, snd B.y))
ligo.60 compile contract y.mligo
File "y.mligo", line 6, characters 6-7:
5 | let main (_ : unit * nat ticket) : operation list * nat ticket =
6 | let n = 10n in
7 | module B = struct
:
Warning: unused variable "n".
Hint: replace it by "_n" to prevent this warning.
Error(s) occurred while type checking the contract:
Ill typed contract:
...
$ _build/install/default/bin/ligo compile contract y.mligo
File "y.mligo", line 8, characters 8-14:
7 | module B = struct
8 | let ticket = Option.unopt (Tezos.create_ticket n n)
9 | let y = ticket, ticket
:
Warning: variable "ticket" cannot be used more than once.
File "y.mligo", line 9, characters 4-26:
8 | let ticket = Option.unopt (Tezos.create_ticket n n)
9 | let y = ticket, ticket
10 | end in
:
Warning: variable "B.y" cannot be used more than once.
Error(s) occurred while type checking the contract:
Ill typed contract:
...
dune @fmt
to check).## Changelog
section with #### (if appropriate).