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

Allowed generic inference from tuples

This commit is contained in:
Brian Fiete 2020-06-14 08:40:09 -07:00
parent ad89d4cc82
commit 3d191b6cc5

View file

@ -515,6 +515,24 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
}
}
}
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;
}