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

Added typeof_comptime const type

This commit is contained in:
Brian Fiete 2025-01-19 12:40:50 -08:00
parent a82cc0534d
commit c511773dad
10 changed files with 111 additions and 10 deletions

View file

@ -551,6 +551,28 @@ namespace Tests
}
}
struct StructD
{
[Comptime]
public static Span<Type> GetTypes()
{
List<Type> list = scope .();
list.Add(typeof(StructA));
list.Add(typeof(EnumA));
return list;
}
}
struct StructE
{
[Comptime]
public static int GetSizes()
{
const let typeList = StructD.GetTypes();
return typeList[0].InstanceSize + typeList[1].InstanceSize;
}
}
[Test]
public static void TestBasics()
{
@ -604,8 +626,6 @@ namespace Tests
Test.Assert(typeof(decltype(f)) == typeof(float));
Test.Assert(ClassB<const 3>.cTimesTen == 30);
DictWrapper<Dictionary<int, float>> dictWrap = scope .();
dictWrap.[Friend]mValue.Add(1, 2.3f);
dictWrap.[Friend]mValue.Add(2, 3.4f);
@ -643,6 +663,9 @@ namespace Tests
DefaultCtorTest dct = .();
Test.Assert(dct.mA == 123);
const int typeSizes = StructE.GetSizes();
Test.Assert(typeSizes == 25);
}
}
}