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

Allow function binding to generic interface constraint method

This commit is contained in:
Brian Fiete 2020-12-26 08:19:30 -08:00
parent 5808bd555c
commit 6029315ff6
2 changed files with 9 additions and 2 deletions

View file

@ -8397,6 +8397,9 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
needsMut = false;
}
if ((mFunctionBindResult != NULL) && (mFunctionBindResult->mSkipMutCheck))
needsMut = false;
if (needsMut)
{
String err = StrFormat("call mutating method '%s' on", mModule->MethodToString(moduleMethodInstance.mMethodInstance).c_str());
@ -10748,8 +10751,12 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
result = mModule->mBfIRBuilder->CreatePtrToInt(funcValue, BfTypeCode_IntPtr);
}
}
else
else if ((bindResult.mOrigTarget) && (bindResult.mOrigTarget.mType->IsGenericParam()) && (bindResult.mMethodInstance->GetOwner()->IsInterface()))
{
result = mModule->mBfIRBuilder->GetFakeVal();
}
else
{
result = mModule->CastToFunction(delegateBindExpr->mTarget, bindResult.mOrigTarget, bindResult.mMethodInstance, mExpectingType);
}
if (result)