1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed crash with 'params' in conversion operator

This commit is contained in:
Brian Fiete 2022-01-21 12:15:48 -05:00
parent dd2ecfb316
commit 023c832565
2 changed files with 6 additions and 2 deletions

View file

@ -2044,7 +2044,10 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
argTypedValue = ResolveArgTypedValue(mArguments[argIdx], paramsElementType, genericArgumentsSubstitute);
if (!argTypedValue.HasType())
goto NoMatch;
if (!mModule->CanCast(argTypedValue, paramsElementType))
BfCastFlags castFlags = ((mBfEvalExprFlags & BfEvalExprFlags_FromConversionOp) != 0) ? BfCastFlags_NoConversionOperator : BfCastFlags_None;
if ((mBfEvalExprFlags & BfEvalExprFlags_FromConversionOp_Explicit) != 0)
castFlags = (BfCastFlags)(castFlags | BfCastFlags_Explicit);
if (!mModule->CanCast(argTypedValue, paramsElementType, castFlags))
goto NoMatch;
argIdx++;
argMatchCount++;

View file

@ -19195,7 +19195,8 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
refNode = operatorDef->mOperatorDeclaration->mCommas[0];
Fail("Conversion operators must declare one parameter", refNode);
}
else if ((methodInstance->mIsUnspecialized) && (!methodInstance->mIsUnspecializedVariation))
else if ((!methodInstance->mIsUnspecialized) ||
((methodInstance->mIsUnspecialized) && (!methodInstance->mIsUnspecializedVariation)))
{
auto checkParam0 = mCurMethodInstance->GetParamType(0);
if ((checkParam0->IsRef()) && (!checkParam0->IsOut()))