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
Add implicit type coercion for integer literals (IntLiteral) to typed
integers (uint/int). The coercion rules are:
- IntLiteral -> uint: Allowed if the literal is non-negative and fits
in the target size (size.bits() <= target.bits())
- IntLiteral -> int: Allowed with strict inequality (size.bits() <
target.bits()) for non-negative values due to TypeSize rounding,
and non-strict for negative values
TypeSize stores ceil(bit_len/8), so int_literal[1] covers 0-255. This
means we can't distinguish edge cases like 127 (fits in int8) from 128
(doesn't fit), so we conservatively require int16+ for int_literal[1].
Note: Negative literal support requires additional work in the type
checker to propagate negativity through unary negation.
0 commit comments