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

Fixed late ctor hiding with extensions

This commit is contained in:
Brian Fiete 2024-12-02 14:34:51 -05:00
parent 124d191bab
commit b900477287
2 changed files with 23 additions and 12 deletions

View file

@ -1277,9 +1277,14 @@ void BfModule::PopulateType(BfType* resolvedTypeRef, BfPopulateType populateType
typeModule->PrepareForIRWriting(resolvedTypeRef->ToTypeInstance());
}
else
{
if ((mCompiler->mCompileState == BfCompiler::CompileState_Unreified) || (mCompiler->mCompileState == BfCompiler::CompileState_VData))
{
FailInternal(StrFormat("Invalid late reification of type '%s'", TypeToString(resolvedTypeRef).c_str()));
}
else
{
BF_ASSERT((mCompiler->mCompileState != BfCompiler::CompileState_Unreified) && (mCompiler->mCompileState != BfCompiler::CompileState_VData));
BfLogSysM("Queued reification of type %p in module %p in PopulateType\n", resolvedTypeRef, typeModule);
BF_ASSERT((typeModule != mContext->mUnreifiedModule) && (typeModule != mContext->mScratchModule));
@ -1293,6 +1298,7 @@ void BfModule::PopulateType(BfType* resolvedTypeRef, BfPopulateType populateType
}
}
}
}
else
{
// If we're a type like "A*", make sure we reify "A" if necessary
@ -6244,13 +6250,17 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
// Generate all methods. Pass 0
for (auto methodDef : typeDef->mMethods)
{
if ((methodDef->mMethodType == BfMethodType_Ctor) && (!methodDef->mIsStatic))
if ((methodDef->mMethodType == BfMethodType_Ctor) && (!methodDef->mIsStatic) && (!methodDef->mDeclaringType->IsExtension()))
{
if (methodDef->mMethodDeclaration == NULL)
{
defaultCtor = methodDef;
}
else
{
hasExplicitCtors = true;
}
}
auto methodInstanceGroup = &typeInstance->mMethodInstanceGroups[methodDef->mIdx];

View file

@ -1924,6 +1924,7 @@ BfType* BfTypeInstance::GetUnionInnerType(bool* wantSplat)
{
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, fieldDef);
if (checkInnerType->IsDataIncomplete())
mModule->PopulateType(checkInnerType, checkInnerType->IsValueType() ? BfPopulateType_Data : BfPopulateType_Declaration);
if (checkInnerType->mSize > unionSize)
unionSize = checkInnerType->mSize;