mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +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");
|
||||
|
||||
BfExprEvaluator exprEvaluator(this);
|
||||
if (exprEvaluator.IsExactMethodMatch(checkMethodInstance, invokeMethod))
|
||||
constraintMatched = true;
|
||||
if (checkMethodInstance->HasExplicitThis() != 0)
|
||||
{
|
||||
// Don't allow functions with explicit 'this'
|
||||
}
|
||||
else
|
||||
{
|
||||
BfExprEvaluator exprEvaluator(this);
|
||||
if (exprEvaluator.IsExactMethodMatch(checkMethodInstance, invokeMethod))
|
||||
constraintMatched = true;
|
||||
}
|
||||
}
|
||||
else if (convCheckConstraint->IsInstanceOf(mCompiler->mDelegateTypeDef))
|
||||
constraintMatched = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue