mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed lookup for 'new' generic conformance
This commit is contained in:
parent
d31c9df8ac
commit
8169587b4c
2 changed files with 24 additions and 7 deletions
|
@ -766,7 +766,7 @@ BfType * BfContext::FindTypeById(int typeId)
|
||||||
|
|
||||||
void BfContext::AddTypeToWorkList(BfType* type)
|
void BfContext::AddTypeToWorkList(BfType* type)
|
||||||
{
|
{
|
||||||
BF_ASSERT(!mAssertOnPopulateType);
|
//BF_ASSERT(!mAssertOnPopulateType);
|
||||||
|
|
||||||
BF_ASSERT((type->mRebuildFlags & BfTypeRebuildFlag_InTempPool) == 0);
|
BF_ASSERT((type->mRebuildFlags & BfTypeRebuildFlag_InTempPool) == 0);
|
||||||
if ((type->mRebuildFlags & BfTypeRebuildFlag_AddedToWorkList) == 0)
|
if ((type->mRebuildFlags & BfTypeRebuildFlag_AddedToWorkList) == 0)
|
||||||
|
|
|
@ -6865,10 +6865,26 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
||||||
{
|
{
|
||||||
if (checkTypeInst->IsObjectOrStruct())
|
if (checkTypeInst->IsObjectOrStruct())
|
||||||
{
|
{
|
||||||
auto ctorClear = GetRawMethodByName(checkTypeInst, "__BfCtor", 0);
|
checkTypeInst->mTypeDef->PopulateMemberSets();
|
||||||
if (ctorClear->mMethodDef->mProtection == BfProtection_Public)
|
BfMemberSetEntry* entry = NULL;
|
||||||
|
BfMethodDef* checkMethodDef = NULL;
|
||||||
|
checkTypeInst->mTypeDef->mMethodSet.TryGetWith(String("__BfCtor"), &entry);
|
||||||
|
if (entry != NULL)
|
||||||
|
checkMethodDef = (BfMethodDef*)entry->mMemberDef;
|
||||||
|
bool hadProtected = false;
|
||||||
|
while (checkMethodDef != NULL)
|
||||||
|
{
|
||||||
|
if (checkMethodDef->mProtection == BfProtection_Public)
|
||||||
|
{
|
||||||
canAlloc = true;
|
canAlloc = true;
|
||||||
else if ((ctorClear->mMethodDef->mProtection == BfProtection_Protected) && (mCurTypeInstance != NULL))
|
break;
|
||||||
|
}
|
||||||
|
if (checkMethodDef->mProtection == BfProtection_Protected)
|
||||||
|
hadProtected = true;
|
||||||
|
checkMethodDef = checkMethodDef->mNextWithSameName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!canAlloc) && (hadProtected) && (mCurTypeInstance != NULL))
|
||||||
canAlloc = TypeIsSubTypeOf(mCurTypeInstance, checkTypeInst, false);
|
canAlloc = TypeIsSubTypeOf(mCurTypeInstance, checkTypeInst, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9024,7 +9040,8 @@ BfMethodInstance* BfModule::GetRawMethodInstanceAtIdx(BfTypeInstance* typeInstan
|
||||||
{
|
{
|
||||||
if (!mCompiler->mIsResolveOnly)
|
if (!mCompiler->mIsResolveOnly)
|
||||||
{
|
{
|
||||||
BF_ASSERT((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl));
|
BF_ASSERT((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl) || (typeInstance->mTypeFailed));
|
||||||
|
if ((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl))
|
||||||
methodGroup.mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
methodGroup.mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
||||||
|
|
||||||
// Get it from the owning module so we don't create a reference prematurely...
|
// Get it from the owning module so we don't create a reference prematurely...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue