mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed unary operations on properties in specialized generic types
This commit is contained in:
parent
23d8e8993b
commit
a8cf568bf9
2 changed files with 15 additions and 1 deletions
|
@ -21479,7 +21479,7 @@ BfTypedValue BfExprEvaluator::PerformUnaryOperation_TryOperator(const BfTypedVal
|
|||
void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr, BfUnaryOp unaryOp, BfTokenNode* opToken, BfUnaryOpFlags opFlags)
|
||||
{
|
||||
BfAstNode* propSrc = mPropSrc;
|
||||
BfTypedValue propTarget = mPropTarget;
|
||||
BfTypedValue propTarget = mOrigPropTarget;
|
||||
BfPropertyDef* propDef = mPropDef;
|
||||
SizedArray<BfResolvedArg, 2> indexerVals = mIndexerValues;
|
||||
BfTypedValue writeToProp;
|
||||
|
|
|
@ -143,6 +143,12 @@ namespace Tests
|
|||
d();
|
||||
}
|
||||
|
||||
class GenClass<T> { public int test { get; set; }; } // Using a field instead of a property wouldn't cause the error
|
||||
|
||||
public static int GenClassMethodA<A>(A a) where A : GenClass<int> { return a.test++; }
|
||||
public static int GenClassMethodB(GenClass<int> a) { return a.test++; }
|
||||
public static int GenClassMethodC<A>(A a) where A : GenClass<int> { return a.test += 1; }
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -161,6 +167,14 @@ namespace Tests
|
|||
Test.Assert(StrTest("ABCDE") == 5);
|
||||
|
||||
Test.Assert(TestEmitMixin(123, 456, .. scope .()) == "123456");
|
||||
|
||||
GenClass<int> gci = scope .();
|
||||
Test.Assert(GenClassMethodA(gci) == 0);
|
||||
Test.Assert(gci.test == 1);
|
||||
Test.Assert(GenClassMethodB(gci) == 1);
|
||||
Test.Assert(gci.test == 2);
|
||||
Test.Assert(GenClassMethodC(gci) == 3);
|
||||
Test.Assert(gci.test == 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue