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:
parent
c23def10f1
commit
5b18e380a5
4 changed files with 56 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue