mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Disallow funcs with explicit 'this' from binding to delegate constraint
This commit is contained in:
parent
527935f371
commit
f8e57ee5ff
1 changed files with 10 additions and 3 deletions
|
@ -8336,9 +8336,16 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
||||||
|
|
||||||
auto invokeMethod = GetRawMethodInstanceAtIdx(convCheckConstraint->ToTypeInstance(), 0, "Invoke");
|
auto invokeMethod = GetRawMethodInstanceAtIdx(convCheckConstraint->ToTypeInstance(), 0, "Invoke");
|
||||||
|
|
||||||
BfExprEvaluator exprEvaluator(this);
|
if (checkMethodInstance->HasExplicitThis() != 0)
|
||||||
if (exprEvaluator.IsExactMethodMatch(checkMethodInstance, invokeMethod))
|
{
|
||||||
constraintMatched = true;
|
// Don't allow functions with explicit 'this'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BfExprEvaluator exprEvaluator(this);
|
||||||
|
if (exprEvaluator.IsExactMethodMatch(checkMethodInstance, invokeMethod))
|
||||||
|
constraintMatched = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (convCheckConstraint->IsInstanceOf(mCompiler->mDelegateTypeDef))
|
else if (convCheckConstraint->IsInstanceOf(mCompiler->mDelegateTypeDef))
|
||||||
constraintMatched = true;
|
constraintMatched = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue