mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Disallow 'var' matching on failed conversion operators
This commit is contained in:
parent
a8d06ea96d
commit
87d4a48a18
1 changed files with 12 additions and 0 deletions
|
@ -2177,6 +2177,13 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
|||
BfCastFlags castFlags = ((mBfEvalExprFlags & BfEvalExprFlags_FromConversionOp) != 0) ? BfCastFlags_NoConversionOperator : BfCastFlags_None;
|
||||
if ((mBfEvalExprFlags & BfEvalExprFlags_FromConversionOp_Explicit) != 0)
|
||||
castFlags = (BfCastFlags)(castFlags | BfCastFlags_Explicit);
|
||||
|
||||
if ((mCheckReturnType != NULL) && (wantType->IsVar()))
|
||||
{
|
||||
// If we allowed this then it would allow too many matches (and allow conversion from any type during CastToValue)
|
||||
goto NoMatch;
|
||||
}
|
||||
|
||||
if (!mModule->CanCast(argTypedValue, wantType, castFlags))
|
||||
{
|
||||
if ((mAllowImplicitWrap) && (argTypedValue.mType->IsWrappableType()) && (mModule->GetWrappedStructType(argTypedValue.mType) == wantType))
|
||||
|
@ -2228,6 +2235,11 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
|||
if (mCheckReturnType != NULL)
|
||||
{
|
||||
auto returnType = methodInstance->mReturnType;
|
||||
if (returnType->IsVar())
|
||||
{
|
||||
// If we allowed this then it would allow too many matches (and allow conversion to any type during CastToValue)
|
||||
goto NoMatch;
|
||||
}
|
||||
if ((genericArgumentsSubstitute != NULL) && (returnType->IsUnspecializedType()))
|
||||
{
|
||||
auto resolvedType = mModule->ResolveGenericType(returnType, typeGenericArguments, genericArgumentsSubstitute, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue