completium / archetype-lang

MIT License
70 stars 9 forks source link

Handle access to records/assets in assets #263

Open guillaumeduhamel opened 2 years ago

guillaumeduhamel commented 2 years ago

tests/proposal-type-errors/no_acces_to_field_in_partition.arl

guillaumeduhamel commented 2 years ago
archetype no_acces_to_field_in_partition

asset a {
  k : nat;
  v : string;
}

asset b {
  n : nat;
  p : partition<a>;
}

variable res : string = ""

entry exec () {
  res := b[0].p[0].v
  // res := a[0].v
}
rognierbenoit commented 2 years ago

same issue as in:

record visitor {
    name : string;
    nbvisits : nat = 0;
    lastVisit : date = 1970-01-01;
}

asset visitors {
    login : address;
    info : visitor;
}

...
visitors[caller].info.nbvisits += 1;