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

Fixed improper generic method variation reification

This commit is contained in:
Brian Fiete 2020-05-25 14:12:53 -07:00
parent 8c2d65ca78
commit 42ae46390d
2 changed files with 25 additions and 14 deletions

View file

@ -11422,9 +11422,12 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
else else
{ {
if ((mIsReified) && (!instModule->mIsReified)) if ((mIsReified) && (!instModule->mIsReified))
{
if (!typeInst->IsUnspecializedTypeVariation())
{ {
if (!instModule->mReifyQueued) if (!instModule->mReifyQueued)
{ {
BF_ASSERT((instModule != mContext->mUnreifiedModule) && (instModule != mContext->mScratchModule));
BF_ASSERT((mCompiler->mCompileState != BfCompiler::CompileState_Unreified) && (mCompiler->mCompileState != BfCompiler::CompileState_VData)); BF_ASSERT((mCompiler->mCompileState != BfCompiler::CompileState_Unreified) && (mCompiler->mCompileState != BfCompiler::CompileState_VData));
BfLogSysM("Queueing ReifyModule: %p\n", instModule); BfLogSysM("Queueing ReifyModule: %p\n", instModule);
mContext->mReifyModuleWorkList.Add(instModule); mContext->mReifyModuleWorkList.Add(instModule);
@ -11440,6 +11443,7 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
specializationRequest->mType = typeInst; specializationRequest->mType = typeInst;
specializationRequest->mFlags = flags; specializationRequest->mFlags = flags;
} }
}
auto defFlags = (BfGetMethodInstanceFlags)(flags & ~BfGetMethodInstanceFlag_ForceInline); auto defFlags = (BfGetMethodInstanceFlags)(flags & ~BfGetMethodInstanceFlag_ForceInline);
@ -19307,6 +19311,11 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
if (methodDef->mMethodType == BfMethodType_Mixin) if (methodDef->mMethodType == BfMethodType_Mixin)
methodInstance->mIsUnspecialized = true; methodInstance->mIsUnspecialized = true;
if (methodInstance->mIsUnspecialized)
{
//BF_ASSERT(methodInstance->mDeclModule == methodInstance->GetOwner()->mModule);
}
BfAutoComplete* bfAutocomplete = NULL; BfAutoComplete* bfAutocomplete = NULL;
if (mCompiler->mResolvePassData != NULL) if (mCompiler->mResolvePassData != NULL)
bfAutocomplete = mCompiler->mResolvePassData->mAutoComplete; bfAutocomplete = mCompiler->mResolvePassData->mAutoComplete;

View file

@ -829,6 +829,8 @@ bool BfModule::PopulateType(BfType* resolvedTypeRef, BfPopulateType populateType
BfLogSysM("Queued reification of type %p in module %p in PopulateType\n", resolvedTypeRef, typeModule); BfLogSysM("Queued reification of type %p in module %p in PopulateType\n", resolvedTypeRef, typeModule);
BF_ASSERT((typeModule != mContext->mUnreifiedModule) && (typeModule != mContext->mScratchModule));
BF_ASSERT(!typeModule->mIsSpecialModule); BF_ASSERT(!typeModule->mIsSpecialModule);
// This caused issues - we may need to reify a type and then request a method // This caused issues - we may need to reify a type and then request a method
typeModule->mReifyQueued = true; typeModule->mReifyQueued = true;