Skip to content

Ligo 0.59.0+ breaks MR 2048 (Make [@annot:] mean no annotation).

We used to be able to use [@annot:] to tell the compiler to not use any annotation. Since 0.59.0 this appears to be broken. I was told to use [@annot] instead, but this also does not work and adds the annotation anyways.

Simple reproducible contract case:

(* annot-issue.mligo  *)
type storage =
  [@layout:comb] {
  token_id                     : nat;
  [@annot:] ignore_annotation  : address list
}

let main (_, s : unit * storage) : operation list * storage = [], s

Compiling with Ligo 0.58.0 we get the expected output:

$ docker run --rm -v "$PWD":"$PWD" -w "$PWD" ligolang/ligo:0.58.0 "compile" "contract" "annot-issue.mligo"
{ parameter unit ;
  storage (pair (nat %token_id) (list address)) ;
  code { CDR ; NIL operation ; PAIR } }

When using Ligo 0.59.0+, we get an error output:

$ docker run --rm -v "$PWD":"$PWD" -w "$PWD" ligolang/ligo:0.62.0 "compile" "contract" "annot-issue.mligo"
File "annot-issue.mligo", line 4, characters 2-3:
  3 |   token_id                     : nat;
  4 |   [@annot:] ignore_annotation  : address list
  5 | }
Ill-formed record type.
At this point one of the following is expected:
  * a field declaration, starting with a field name;
  * a closing brace '}' if the record is complete.

Now we change to use [@annot] as suggested:

(* annot-issue-2.mligo  *)
type storage =
  [@layout:comb] {
  token_id                     : nat;
  [@annot] ignore_annotation   : address list
}

let main (_, s : unit * storage) : operation list * storage = [], s

When we compile now, there is no error, but the annotation is not ignored and we do not get the expected output:

$ docker run --rm -v "$PWD":"$PWD" -w "$PWD" ligolang/ligo:0.62.0 "compile" "contract" "annot-issue-2.mligo"
{ parameter unit ;
  storage (pair (nat %token_id) (list %ignore_annotation address)) ;
  code { CDR ; NIL operation ; PAIR } }