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

Fixed type inference with unspecialized type variations

This commit is contained in:
Brian Fiete 2020-12-26 17:37:08 -08:00
parent 585db3b579
commit 91a5ef67e5

View file

@ -260,7 +260,7 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
BfType* methodGenericTypeConstraint = NULL; BfType* methodGenericTypeConstraint = NULL;
auto _SetGeneric = [&]() auto _SetGeneric = [&]()
{ {
if (argType != NULL) if (argType != NULL)
{ {
// Disallow illegal types // Disallow illegal types
@ -358,7 +358,10 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
auto prevArgValue = mPrevArgValues[wantGenericParam->mGenericParamIdx]; auto prevArgValue = mPrevArgValues[wantGenericParam->mGenericParamIdx];
if (prevGenericMethodArg == NULL) if (prevGenericMethodArg == NULL)
{ {
_SetGeneric(); if ((argType != NULL) && (argType->IsUnspecializedTypeVariation()))
argType = mModule->ResolveGenericType(argType, NULL, mCheckMethodGenericArguments);
if (argType != NULL)
_SetGeneric();
return true; return true;
} }
@ -13910,7 +13913,12 @@ BfModuleMethodInstance BfExprEvaluator::GetSelectedMethod(BfAstNode* targetSrc,
if (methodDef->IsEmptyPartial()) if (methodDef->IsEmptyPartial())
return methodInstance; return methodInstance;
if (methodDef->mName == "RemoveFast")
{
NOP;
}
if (methodInstance.mMethodInstance->mMethodInfoEx != NULL) if (methodInstance.mMethodInstance->mMethodInfoEx != NULL)
{ {
for (int checkGenericIdx = 0; checkGenericIdx < (int)methodInstance.mMethodInstance->mMethodInfoEx->mGenericParams.size(); checkGenericIdx++) for (int checkGenericIdx = 0; checkGenericIdx < (int)methodInstance.mMethodInstance->mMethodInfoEx->mGenericParams.size(); checkGenericIdx++)