Browse Source

Continue searching in CastToValue constraint check on method return fail

Brian Fiete 3 years ago
parent
commit
e4cac2ca24
1 changed files with 5 additions and 1 deletions
  1. 5 1
      IDEHelper/Compiler/BfModuleTypeUtils.cpp

+ 5 - 1
IDEHelper/Compiler/BfModuleTypeUtils.cpp

@@ -13764,7 +13764,11 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
 		{
 			auto result = BfTypedValue(mBfIRBuilder->GetFakeVal(), operatorConstraintReturnType);
 			if (result.mType != toType)
-				return CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
+			{
+				auto castedResult = CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
+				if (castedResult)
+					return castedResult;
+			}
 			if (result)
 				return result.mValue;
 		}