You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We may need to instruct if a variable is a constant during assignment, as the assigned value can't represent itself as a constant at type checking phase until synthesizer phase in some cases.
For example:
// this value being assigned should be a constantlet size_bit_len = bits::bit_len(SIZE);
But the return signature bits::bit_len can't reflect it is a constant:
fnbit_len(constSIZE:Field) -> Field;
To instruct the size_bit_len to be a constant field in order to bypass certain type checks, we would:
const size_bit_len = bits::bit_len(SIZE);
This would bypass the checks in the case:
comparator::less_than(size_bit_len, ii,2)
where the less_than signature is
fnless_than(constLEN:Field,lhs:Field,rhs:Field) -> Field
At synthesizer phase, the assignment can check if the value being assigned is a constant based on the ConstOrVar struct.
The text was updated successfully, but these errors were encountered:
Maybe the better way would delay this type check to the MAST phase where it can propagate the constant values.
So it can just check if the argument being propagated is a constant.
To do so, we will need to propagate constant values from both builtins and native functions.
We may need to instruct if a variable is a constant during assignment, as the assigned value can't represent itself as a constant at type checking phase until synthesizer phase in some cases.
For example:
But the return signature
bits::bit_len
can't reflect it is a constant:To instruct the
size_bit_len
to be a constant field in order to bypass certain type checks, we would:This would bypass the checks in the case:
where the less_than signature is
At synthesizer phase, the assignment can check if the value being assigned is a constant based on the
ConstOrVar
struct.The text was updated successfully, but these errors were encountered: