Skip to content

CIF type checker: make min/max functions smarter in determining int result type ranges

For this model:

input int i;
alg int[0..1000] a = max(0, min(i, 1000));

We currently get a type error, since for the min and max functions the type checker determines the result type as int and that doesn't fit in the type of a. The type checker only determines int type lower/upper bounds if both arguments have type ranges. However, if just one of them has a range, like in this case, it could also determine a range.

I think that would be a practical change, to allow making a CIF int type into a ranged integer type. It relates to things being discussed in #1107 and #1109.