Casting to/from BigInteger doesn't work correctly
Expressions don't propagate correctly the information whether BigInteger is used within the expression. We should keep the information even when the exact value can be evaluated.
Example:
const uint64 CONST_U64 = 10;
const uint8 CONST_U8 = CONST_U64;
In the example CONST_U64 has to keep information that needs BigInteger, because it has a BigInteger type in java. Therefore in the definition of CONST_U8, the BigInteger CONST_U64 has to be correclty casted to byte.
Note that there are more use-cases, e.g. definition of enum items, and all the use-cases have to be reviewed.
Another use case:
enum uint64 TestEnum
{
ONE, TWO, THREE
};
struct Test
{
uint64 field1;
uint32 field2 : field2 < field1;
uint8 field3 : field3 < valueof(TestEnum.ONE);
};
Another use case:
struct Test
{
uint32 field32;
uint64 field64;
bit<field32 + field64> bitField;
};
Another issue, alignment doesn't generate correct big integer expression.
struct Test
{
align(Const - 2):
string text;
};
Another issue:
const uint64 Constant = 2;
choice TestChoice(uint64 param) on (param + 2)
{
case 2 + Constant:
string field;
};