I believe this is a bug. If not, please let me know and I'll close the issue.
union MyUnion = x | a(bool) | b(b256) | c(int) | d({ int, b256 }) | e({ b256, bool });
type MyAlias = MyUnion;
storage {
a: (MyAlias => bool),
}
predicate Test() {
let a = mut storage::a[MyAlias::d({ 576, 0x0000000000000003000000000000000400000000000000030000000000000004 })];
constraint a == false;
}
results in
Error: unknown union
╭─[test.pnt:9:28]
│
9 │ let a = mut storage::a[MyAlias::d({ 576, 0x0000000000000003000000000000000400000000000000030000000000000004 })];
│ ─────┬────
│ ╰────── union declaration for `::MyAlias::d` not found
───╯
Error: attempt to index a storage map with a mismatched value
╭─[test.pnt:9:28]
│
9 │ let a = mut storage::a[MyAlias::d({ 576, 0x0000000000000003000000000000000400000000000000030000000000000004 })];
│ ───────────────────────────────────────────┬───────────────────────────────────────────
│ ╰───────────────────────────────────────────── storage map access must be with a `::MyAlias (::MyUnion)` variant
│
│ Note: found access using type `Error`
───╯
if the storage map is accessed with the union it will work properly
union MyUnion = x | a(bool) | b(b256) | c(int) | d({ int, b256 }) | e({ b256, bool });
type MyAlias = MyUnion;
storage {
a: (MyAlias => bool),
}
predicate Test() {
let a = mut storage::a[MyUnion::d({ 576, 0x0000000000000003000000000000000400000000000000030000000000000004 })]; // Using MyUnion here
constraint a == false;
}
I believe this is a bug. If not, please let me know and I'll close the issue.
if the
storage map
is accessed with theunion
it will work properly