essential-contributions / pint

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

Allow `Map` to be declared outside of `Storage Block` #780

Closed lethalgem closed 3 months ago

lethalgem commented 3 months ago

Closes #574

Allows:

declaring map at the global level to be used in a storage block

type MyMap = (int => int);
type MyInt = int;
type MyNestMap = (MyInt => int);

storage {
    m: MyMap,
    n: MyInt,
    o: MyNestMap,
}

Disallows:

using map type declaration as a var

predicate test {
    type MyMap = (int => int);

    var y: MyMap;
    var x: ( int => int );
}

and declaring a map type inside of the storage block

storage {
    type MyMap = (b256 => int);
}

Let me know if there are other test scenarios I should include/work on