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

Fixed variable assignment detection with classes member values

This commit is contained in:
Brian Fiete 2021-01-21 04:42:15 -08:00
parent 458eb90752
commit e1394e2fb7
2 changed files with 37 additions and 4 deletions

View file

@ -25,5 +25,35 @@ namespace IDETest
}
}
}
public class ClassD
{
public int mA;
public int mB;
}
public struct StructA
{
public int32 mA;
public int32 mB;
}
public struct StructB
{
ClassD parent;
StructA mSA;
int mInnerInt;
public this(ClassD test)
{
parent = test;
mInnerInt = parent.mA;
mSA.mA = 123;
int a = mSA.mA;
int b = mSA.mB; //FAIL
mSA.mB = 234;
}
}
}
}

View file

@ -603,7 +603,7 @@ bool BfGenericInferContext::InferGenericArguments(BfMethodInstance* methodInstan
{
InferGenericArgument(methodInstance, srcGenericArg, ifaceConstraint, BfIRValue());
auto typeInstance = srcGenericArg->ToTypeInstance();
if (typeInstance == NULL)
if ((typeInstance == NULL) && (srcGenericArg->IsWrappableType()))
typeInstance = mModule->GetWrappedStructType(srcGenericArg);
if (typeInstance != NULL)
@ -4544,10 +4544,13 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
}
if ((mResultLocalVar != NULL) && (fieldInstance->mMergedDataIdx != -1))
{
if (mResultLocalVarFieldCount != 1)
{
fieldInstance->GetDataRange(mResultLocalVarField, mResultLocalVarFieldCount);
mResultLocalVarRefNode = targetSrc;
}
}
if ((curCheckType->IsIncomplete()) && (!curCheckType->mNeedsMethodProcessing))
{