mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Allow function binding to generic interface constraint method
This commit is contained in:
parent
5808bd555c
commit
6029315ff6
2 changed files with 9 additions and 2 deletions
|
@ -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,6 +10751,10 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
|
|||
result = mModule->mBfIRBuilder->CreatePtrToInt(funcValue, BfTypeCode_IntPtr);
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -3813,7 +3813,7 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
|
|||
bool isMutating = true;
|
||||
|
||||
int paramRefOfs = 0;
|
||||
if (!rhsDelegateType->mParams.IsEmpty())
|
||||
if ((!rhsDelegateType->mParams.IsEmpty()) && (lhs->IsFunction()))
|
||||
{
|
||||
auto param0 = rhsDelegateType->mParams[0];
|
||||
if ((param0->mNameNode != NULL) && (param0->mNameNode->Equals("this")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue