1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed generic interference with generic tuples

This commit is contained in:
Brian Fiete 2020-08-26 06:10:36 -07:00
parent 7e947265da
commit 79c9f5d818
6 changed files with 41 additions and 26 deletions

View file

@ -395,6 +395,24 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
return true;
}
if (wantType->IsTuple())
{
if (argType->IsTuple())
{
auto wantTupleType = (BfTupleType*)wantType;
auto argTupleType = (BfTupleType*)argType;
if (wantTupleType->mFieldInstances.size() == argTupleType->mFieldInstances.size())
{
for (int fieldIdx = 0; fieldIdx < (int)wantTupleType->mFieldInstances.size(); fieldIdx++)
{
InferGenericArgument(methodInstance, argTupleType->mFieldInstances[fieldIdx].mResolvedType,
wantTupleType->mFieldInstances[fieldIdx].mResolvedType, BfIRValue());
}
}
}
}
if ((wantType->IsGenericTypeInstance()) && (wantType->IsUnspecializedTypeVariation()))
{
auto wantGenericType = (BfTypeInstance*)wantType;
@ -522,25 +540,7 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
InferGenericArgument(methodInstance, argInvokeMethod->GetParamType(argIdx), wantInvokeMethod->GetParamType(argIdx), BfIRValue());
}
}
}
if (wantType->IsTuple())
{
if (argType->IsTuple())
{
auto wantTupleType = (BfTupleType*)wantType;
auto argTupleType = (BfTupleType*)argType;
if (wantTupleType->mFieldInstances.size() == argTupleType->mFieldInstances.size())
{
for (int fieldIdx = 0; fieldIdx < (int)wantTupleType->mFieldInstances.size(); fieldIdx++)
{
InferGenericArgument(methodInstance, argTupleType->mFieldInstances[fieldIdx].mResolvedType,
wantTupleType->mFieldInstances[fieldIdx].mResolvedType, BfIRValue());
}
}
}
}
}
return true;
}
@ -18380,11 +18380,6 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExpression* rightExpression, BfBinaryOp binaryOp, BfTokenNode* opToken, BfBinOpFlags flags)
{
if ((mModule->mCurMethodInstance != NULL) && (mModule->mCurMethodInstance->mMethodDef->mName == "Angle"))
{
NOP;
}
BfTypedValue leftValue;
if (leftExpression != NULL)
{