Change cast and int rules: constant folding always starts. Promotion using left side on all operands to bit width. Implicit narrowing to max size on right hand side.

This commit is contained in:
Christoffer Lerno
2021-03-15 16:44:09 +01:00
committed by Christoffer Lerno
parent 8a7f37e4d3
commit 07595df412
52 changed files with 1553 additions and 1462 deletions

View File

@@ -1,20 +1,20 @@
const char AA = ~0;
const char AA = ~cast(0 as char);
const char BB = 200 ;
const uint CC = ~0;
const uint CC = ~cast(0 as uint);
const uint DD = FOO;
const FOO = ~0;
const FOO = ~cast(0 as uint);
uint x = AA;
uint z = CC;
char w = FOO;
ushort v = FOO;
char w = cast(FOO as char);
ushort v = cast(FOO as ushort);
uint z2 = DD;
func void test()
{
int xx = FOO;
int* yy = &&FOO;
uint* yy = &&FOO;
}
// #expect: constants.ll