mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fix for generic constraints checking with mixins
This commit is contained in:
parent
e865e675a7
commit
1e7bd7d43f
2 changed files with 77 additions and 0 deletions
|
@ -13286,6 +13286,31 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
|
|||
return;
|
||||
auto methodInstance = moduleMethodInstance.mMethodInstance;
|
||||
|
||||
for (int checkGenericIdx = 0; checkGenericIdx < (int)methodMatcher.mBestMethodGenericArguments.size(); checkGenericIdx++)
|
||||
{
|
||||
auto& genericParams = methodInstance->mMethodInfoEx->mGenericParams;
|
||||
auto genericArg = methodMatcher.mBestMethodGenericArguments[checkGenericIdx];
|
||||
if (genericArg->IsVar())
|
||||
continue;
|
||||
|
||||
BfAstNode* paramSrc;
|
||||
if (methodMatcher.mBestMethodGenericArgumentSrcs.size() == 0)
|
||||
paramSrc = targetSrc;
|
||||
else
|
||||
paramSrc = methodMatcher.mArguments[methodMatcher.mBestMethodGenericArgumentSrcs[checkGenericIdx]].mExpression;
|
||||
|
||||
// Note: don't pass methodMatcher.mBestMethodGenericArguments into here, this method is already specialized
|
||||
BfError* error = NULL;
|
||||
if (!mModule->CheckGenericConstraints(BfGenericParamSource(methodInstance), genericArg, paramSrc, genericParams[checkGenericIdx], NULL, &error))
|
||||
{
|
||||
if (methodInstance->mMethodDef->mMethodDeclaration != NULL)
|
||||
{
|
||||
if (error != NULL)
|
||||
mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See method declaration"), methodInstance->mMethodDef->GetRefNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check circular ref based on methodInstance
|
||||
{
|
||||
bool hasCircularRef = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue