Open mohammadfawaz opened 4 months ago
We already add constraints for enum
variants and I was considering it for bool
s too.
For (2), storing a smaller type in a bigger one, how could we constrain it?
Update: we don't have any checks currently and we should add all of them for all types, where possible. Not sure how we do this for dynamic arrays though.. maybe a constraint that uses the len
intrinsic (which we want to add)
Absolutely -- we'd use len()
.
Type safety in general is a bit shaky at the moment. I'm mostly referring to proposed solutions here.
Here are some examples:
int
at ab256
without issues.I believe that every decision variable and every state mutation must satisfy some additional constraints, enforced by the compiler, that make sure that the proposed values do not violate the rules of the type.