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

Generic resolution fix

This commit is contained in:
Brian Fiete 2025-01-02 13:33:45 -08:00
parent 5d55409841
commit 7f9a272e23
3 changed files with 58 additions and 41 deletions

View file

@ -2344,7 +2344,16 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
// If we allowed this then it would allow too many matches (and allow conversion to any type during CastToValue) // If we allowed this then it would allow too many matches (and allow conversion to any type during CastToValue)
goto NoMatch; goto NoMatch;
} }
bool doFullTypeResolve = false;
if (returnType->IsUnspecializedTypeVariation())
{
returnType = typeUnspecMethodInstance->mReturnType;
doFullTypeResolve = true;
}
if ((genericArgumentsSubstitute != NULL) && (returnType->IsUnspecializedType())) if ((genericArgumentsSubstitute != NULL) && (returnType->IsUnspecializedType()))
doFullTypeResolve = true;
if (doFullTypeResolve)
{ {
auto resolvedType = mModule->ResolveGenericType(returnType, typeGenericArguments, genericArgumentsSubstitute, mModule->mCurTypeInstance, false); auto resolvedType = mModule->ResolveGenericType(returnType, typeGenericArguments, genericArgumentsSubstitute, mModule->mCurTypeInstance, false);
if (resolvedType == NULL) if (resolvedType == NULL)
@ -6383,7 +6392,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
mModule->mCurMethodState->mCancelledDeferredCall = true; mModule->mCurMethodState->mCancelledDeferredCall = true;
} }
if (methodDef->mIsNoReturn) if ((methodDef->mIsNoReturn) && ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) == 0))
{ {
mModule->mCurMethodState->SetHadReturn(true); mModule->mCurMethodState->SetHadReturn(true);
mModule->mCurMethodState->mLeftBlockUncond = true; mModule->mCurMethodState->mLeftBlockUncond = true;

View file

@ -21653,8 +21653,12 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
else else
{ {
auto innerMethodDef = innerMethodInstance.mMethodInstance->mMethodDef; auto innerMethodDef = innerMethodInstance.mMethodInstance->mMethodDef;
BF_ASSERT(innerMethodDef == methodDef); if ((innerMethodDef == methodDef != NULL) && (!CompareMethodSignatures(methodInstance, innerMethodInstance.mMethodInstance)))
{
InternalError("Boxing method passthrough error");
}
else
{
SizedArray<BfIRValue, 8> innerParams; SizedArray<BfIRValue, 8> innerParams;
BfExprEvaluator exprEvaluator(this); BfExprEvaluator exprEvaluator(this);
@ -21700,6 +21704,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
} }
} }
} }
}
mCurMethodState->SetHadReturn(true); mCurMethodState->SetHadReturn(true);
mCurMethodState->mLeftBlockUncond = true; mCurMethodState->mLeftBlockUncond = true;

View file

@ -3472,6 +3472,9 @@ void BfModule::DoPopulateType_TypeAlias(BfTypeAliasType* typeAlias)
void BfModule::DoPopulateType_InitSearches(BfTypeInstance* typeInstance) void BfModule::DoPopulateType_InitSearches(BfTypeInstance* typeInstance)
{ {
if (typeInstance->IsBoxed())
return;
auto typeDef = typeInstance->mTypeDef; auto typeDef = typeInstance->mTypeDef;
auto _AddStaticSearch = [&](BfTypeDef* typeDef) auto _AddStaticSearch = [&](BfTypeDef* typeDef)