CIF: Equal/Unequal on combination of ints and reals is inconsistent
Consider the following specification:
alg bool a1 = 1.0 = 1;
alg bool a2 = 1 = 1.0;
The first is allowed, and the second is not:
Binary operator "=" can not be applied to values of type "int[1..1]" and "real".
I've analyzed the problem and found the following.
- The typechecker provides 'type hints' for the right part of the equal. In the first case, the type hint is 'real', in the second case the type hint is 'int' (See here).
- The typechecker 'widens' int types to reals if 'real' is given as a hint (See here).
- As a result, the first expression is
<real> = <real>
which is allowed, whereas the second expression is<int> = <real>
, which is not allowed.
While I am not sure what the behaviour should be, I think the current behaviour is inconsistent.