mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
CheckGenericCtor fixes
This commit is contained in:
parent
1a1f6f793b
commit
da3c5c3c57
2 changed files with 13 additions and 1 deletions
|
@ -9453,6 +9453,10 @@ bool BfExprEvaluator::CheckGenericCtor(BfGenericParamType* genericParamType, BfR
|
|||
mModule->Fail(StrFormat("Must add 'where %s : struct' constraint to generic parameter to instantiate type without allocator", genericParam->GetGenericParamDef()->mName.c_str()), targetSrc);
|
||||
success = false;
|
||||
}
|
||||
else if ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) != 0)
|
||||
{
|
||||
mModule->Fail(StrFormat("Generic parameter '%s' constructor cannot be guaranteed to be const-evaluable", genericParam->GetGenericParamDef()->mName.c_str()), targetSrc);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -18614,7 +18618,8 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
|
|||
BfResolveArgsFlags resolveArgsFlags = BfResolveArgsFlag_None;
|
||||
ResolveArgValues(argValues, resolveArgsFlags);
|
||||
|
||||
CheckGenericCtor((BfGenericParamType*)expectingType, argValues, invocationExpr->mTarget);
|
||||
if (!mModule->mCurMethodInstance->mIsUnspecializedVariation)
|
||||
CheckGenericCtor((BfGenericParamType*)expectingType, argValues, invocationExpr->mTarget);
|
||||
mResult = mModule->GetDefaultTypedValue(expectingType);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9558,6 +9558,13 @@ BfGenericParamInstance* BfModule::GetGenericTypeParamInstance(int genericParamId
|
|||
// curTypeInstance = mCurMethodInstance->mMethodInstanceGroup->mOwner;
|
||||
|
||||
BfTypeInstance* genericTypeInst = curTypeInstance->ToGenericTypeInstance();
|
||||
|
||||
if (genericTypeInst == NULL)
|
||||
{
|
||||
FatalError("Invalid mCurTypeInstance for GetGenericTypeParamInstance");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((genericTypeInst->IsIncomplete()) && (genericTypeInst->mGenericTypeInfo->mGenericParams.size() == 0))
|
||||
{
|
||||
// Set this to NULL so we don't recurse infinitely
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue