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:
parent
e6352571c1
commit
052edbcb8d
2 changed files with 18 additions and 0 deletions
|
@ -20046,6 +20046,9 @@ BfTypedValue BfExprEvaluator::PerformAssignment_CheckOp(BfAssignmentExpression*
|
||||||
{
|
{
|
||||||
if (!mModule->CanCast(rightValue, paramType))
|
if (!mModule->CanCast(rightValue, paramType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
rightValue = mModule->Cast(assignExpr->mLeft, rightValue, paramType);
|
||||||
|
BF_ASSERT(rightValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
mModule->SetElementType(assignExpr->mOpToken, BfSourceElementType_Method);
|
mModule->SetElementType(assignExpr->mOpToken, BfSourceElementType_Method);
|
||||||
|
|
|
@ -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 struct Vector2 : this(float x, float y);
|
||||||
|
|
||||||
public static Event<Action> sEvent ~ _.Dispose(); // Workaround for the lack of auto-destructor in properties
|
public static Event<Action> sEvent ~ _.Dispose(); // Workaround for the lack of auto-destructor in properties
|
||||||
|
@ -728,6 +738,11 @@ namespace Tests
|
||||||
rcStr.Release();
|
rcStr.Release();
|
||||||
|
|
||||||
//RefCounted<StructB> rcB = .Create();
|
//RefCounted<StructB> rcB = .Create();
|
||||||
|
|
||||||
|
ClassA ca = scope .();
|
||||||
|
ca += "ab";
|
||||||
|
ca += "cd";
|
||||||
|
Test.Assert(ca.value == "abcd");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IntStruct
|
struct IntStruct
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue