essential-contributions / pint

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

Allow type aliases for storage vars. #760

Closed otrho closed 3 months ago

otrho commented 3 months ago

This moves the type check for storage vars out of the parser and into the type checker.

The check is done after custom types have been lowered, so checks like ty.is_bool() will work, even if they're aliases. This wasn't possible at the parse stage.

It also ensures that custom types are lowered for storage vars (they didn't have to be until now -- the parser used to reject them) and they are also lowered for flattening.

Argh, the diff is a bit confused because I refactored the instance type checking into their own methods and then put the storage checks where it used to be...

Closes #745.

Note: this is based on #758 and should probably be merged after it's in.