essential-contributions / pint

Pint, the constraint-based programming language for declarative blockchains
Apache License 2.0
17 stars 3 forks source link

Storage variable `Custom` types are not properly checked #854

Closed mohammadfawaz closed 1 month ago

mohammadfawaz commented 1 month ago

E.g.

storage {
    x: Foo,
}

Errors:

❯ pintc all_types.pnt
Error: compiler internal error: only ints, bools, and maps are currently allowed in a storage block
   ╭─[all_types.pnt:7:5]
   │
 7 │     x: Foo,
   │     ────┬───
   │         ╰───── only ints, bools, and maps are currently allowed in a storage block
───╯

We should instead be emitting an error that indicates that the type Foo does not exist. If we were to write this instead:

predicate Foo {
    var x: Foo;
}

we would get

Error: undefined type
   ╭─[all_types.pnt:7:12]
   │
 7 │     var x: Foo;
   │            ─┬─
   │             ╰─── type is undefined
───╯

which is reasonable.