1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed const expr canonicalization and negative value issues

This commit is contained in:
Brian Fiete 2021-12-31 07:56:57 -05:00
parent e7f079f611
commit fa7638621d
7 changed files with 53 additions and 22 deletions

View file

@ -19,14 +19,14 @@ namespace Tests
}
}
class ClassB<T, TSize> where TSize : const int
class ClassB<T, TSize> where TSize : const int8
{
ClassA<T, TSize> mVal = new ClassA<T, const TSize>() ~ delete _;
var mVal2 = new ClassA<T, const TSize + 100>() ~ delete _;
public int GetVal()
{
return mVal.GetVal();
return mVal.GetVal();
}
public int GetVal2()
@ -55,6 +55,10 @@ namespace Tests
Test.Assert(cb.GetVal() == 123);
Test.Assert(cb.GetVal2() == 223);
ClassB<float, const -45> cb2 = scope .();
Test.Assert(cb2.GetVal() == -45);
Test.Assert(cb2.GetVal2() == 55);
ClassC<const EnumA.A> cc = scope .();
Test.Assert(cc.Test() == 1);
}

View file

@ -499,6 +499,10 @@ namespace Tests
const int32 c1 = 1;
int i0 = 0;
var tVal = Vector2((i0 % c0) * (c1 + c1), 1);
int8 a = 123;
int32 b = a + 100;
Test.Assert(b == 223);
}
struct IntStruct