1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 23:34:10 +02:00

Allow anonymous 'using' fields

This commit is contained in:
Brian Fiete 2025-01-05 08:55:17 -08:00
parent 613f9c743a
commit 854122cb46
9 changed files with 323 additions and 256 deletions

View file

@ -48,14 +48,25 @@ namespace Tests
[Union]
struct Vector2
{
public struct Coords
{
public float mX;
public float mY;
}
public struct Coords : this(float mX, float mY);
public float[2] mValues;
public using Coords mCoords;
using public Coords mCoords;
public this(float x, float y)
{
mX = x;
mY = y;
}
}
[Union]
struct Vector2b
{
public struct Coords : this(float mX, float mY);
public float[2] mValues;
public using Coords;
public this(float x, float y)
{
@ -80,8 +91,16 @@ namespace Tests
Test.Assert(sizeof(Vector2) == 8);
Test.Assert(vec.mX == 1.2f);
Test.Assert(vec.mY == 2.3f);
Test.Assert(vec.mCoords == .(1.2f, 2.3f));
Test.Assert(vec.mValues[0] == 1.2f);
Test.Assert(vec.mValues[1] == 2.3f);
Vector2b vecb = .(1.2f, 2.3f);
Test.Assert(sizeof(Vector2b) == 8);
Test.Assert(vecb.mX == 1.2f);
Test.Assert(vecb.mY == 2.3f);
Test.Assert(vecb.mValues[0] == 1.2f);
Test.Assert(vecb.mValues[1] == 2.3f);
}
}
}