1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed assignment operator RHS conversion issue

This commit is contained in:
Brian Fiete 2022-08-03 08:16:41 -07:00
parent e6352571c1
commit 052edbcb8d
2 changed files with 18 additions and 0 deletions

View file

@ -20046,6 +20046,9 @@ BfTypedValue BfExprEvaluator::PerformAssignment_CheckOp(BfAssignmentExpression*
{
if (!mModule->CanCast(rightValue, paramType))
continue;
rightValue = mModule->Cast(assignExpr->mLeft, rightValue, paramType);
BF_ASSERT(rightValue);
}
mModule->SetElementType(assignExpr->mOpToken, BfSourceElementType_Method);

View file

@ -483,6 +483,16 @@ namespace Tests
}
}
class ClassA
{
public String value = new .() ~ delete _;
public void operator+=(StringView value)
{
this.value.Append(value);
}
}
public struct Vector2 : this(float x, float y);
public static Event<Action> sEvent ~ _.Dispose(); // Workaround for the lack of auto-destructor in properties
@ -728,6 +738,11 @@ namespace Tests
rcStr.Release();
//RefCounted<StructB> rcB = .Create();
ClassA ca = scope .();
ca += "ab";
ca += "cd";
Test.Assert(ca.value == "abcd");
}
struct IntStruct