1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-06 16:25:59 +02:00

Fixed generic assignment operators (ie +=)

This commit is contained in:
Brian Fiete 2025-05-30 11:20:04 +02:00
parent c23def10f1
commit 5b18e380a5
4 changed files with 56 additions and 4 deletions

View file

@ -428,6 +428,21 @@ namespace Tests
}
}
struct A<T>
{
public int mA;
public static Self operator implicit<U>(U value)
{
return default;
}
public void operator +=<U>(A<U> r) mut
{
mA += r.mA;
}
}
[Test]
public static void TestBasics()
{
@ -521,6 +536,11 @@ namespace Tests
int iVal = 123;
Test.Assert(IntPtrTest(&iVal) == 123);
A<int> a = .() { mA = 10 };
A<float> b = .() { mA = 2 };
a += b;
Test.Assert(a.mA == 12);
}
}