spicy icon indicating copy to clipboard operation
spicy copied to clipboard

Integer for `&max-size` is not coerced to unsigned integer

Open bbannier opened this issue 3 years ago • 0 comments

Before #984 we would correctly coerce an integer passed to &max-size to an unsigned integer, e.g., this worked:

module foo;

public type X = unit {
	xs: bytes &max-size=1 &eod;
};

This now requires a cast, i.e., a field xs: bytes &max-size=cast<uint64>(1) &eod; else the user sees

[error] x.spicy:3:17-5:2: operator usage is ambiguous: <uint<64>> + <int<64>>
[error] x.spicy:3:17-5:2:   candidates:
[error] x.spicy:3:17-5:2:   - <int<64>> + <int<64>> [hilti::operator_::signed_integer::Sum]
[error] x.spicy:3:17-5:2:   - <uint<64>> + <uint<64>> [hilti::operator_::unsigned_integer::Sum]
[error] x.spicy:3:17-5:2: unknown ID '__max_size'
[error] x.spicy:3:17-5:2: unknown ID '__limited'
[error] x.spicy:3:17-5:2: unknown ID '__ncur'
[error] spicyc: aborting after errors

bbannier avatar Jun 02 '22 14:06 bbannier