213 references to BetterResult
Microsoft.CodeAnalysis.CSharp (213)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (16)
735return BetterResult.Equal; 742return BetterResult.Neither; 744return leftWins ? BetterResult.Left : BetterResult.Right; 774return BetterResult.Equal; 781return BetterResult.Neither; 783return leftWins ? BetterResult.Left : BetterResult.Right; 804private static int? UniqueBestValidIndex<T>(ImmutableArray<T> items, Func<T, bool> valid, Func<T, T, BetterResult> better) 829BetterResult result = better(candidateItem, currentItem); 831if (result == BetterResult.Equal) 836else if (result == BetterResult.Neither) 844else if (result == BetterResult.Right) 871BetterResult result = better(candidateItem, currentItem); 872if (result != BetterResult.Left && result != BetterResult.Equal)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (40)
1117var better = BetterOperator(candidates[i].Signature, candidates[j].Signature, left, right, ref useSiteInfo); 1118if (better == BetterResult.Left) 1122else if (better == BetterResult.Right) 1151var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo); 1152if (better == BetterResult.Right) 1157else if (better != BetterResult.Left) 1173var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo); 1174if (better != BetterResult.Left) 1184private BetterResult BetterOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, BoundExpression left, BoundExpression right, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1190return (op1.Priority.GetValueOrDefault() < op2.Priority.GetValueOrDefault()) ? BetterResult.Left : BetterResult.Right; 1193BetterResult leftBetter = BetterConversionFromExpression(left, op1.LeftType, op2.LeftType, ref useSiteInfo); 1194BetterResult rightBetter = BetterConversionFromExpression(right, op1.RightType, op2.RightType, ref useSiteInfo); 1215if (leftBetter == BetterResult.Left && rightBetter != BetterResult.Right || 1216leftBetter != BetterResult.Right && rightBetter == BetterResult.Left) 1218return BetterResult.Left; 1221if (leftBetter == BetterResult.Right && rightBetter != BetterResult.Left || 1222leftBetter != BetterResult.Left && rightBetter == BetterResult.Right) 1224return BetterResult.Right; 1256BetterResult result = MoreSpecificOperator(op1, op2, ref useSiteInfo); 1257if (result == BetterResult.Left || result == BetterResult.Right) 1270return BetterResult.Right; 1274return BetterResult.Left; 1279BetterResult valOverInPreference; 1283valOverInPreference = BetterResult.Left; 1287valOverInPreference = BetterResult.Right; 1291valOverInPreference = BetterResult.Neither; 1296if (valOverInPreference == BetterResult.Right) 1298return BetterResult.Neither; 1302valOverInPreference = BetterResult.Left; 1307if (valOverInPreference == BetterResult.Left) 1309return BetterResult.Neither; 1313valOverInPreference = BetterResult.Right; 1320private BetterResult MoreSpecificOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1366BetterResult result = MoreSpecificType(ref uninst1.AsRef(), ref uninst2.AsRef(), ref useSiteInfo);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (17)
117var better = BetterOperator(candidates[i].Signature, candidates[j].Signature, operand, ref useSiteInfo); 118if (better == BetterResult.Left) 122else if (better == BetterResult.Right) 150var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, operand, ref useSiteInfo); 151if (better == BetterResult.Right) 156else if (better != BetterResult.Left) 172var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, operand, ref useSiteInfo); 173if (better != BetterResult.Left) 183private BetterResult BetterOperator(UnaryOperatorSignature op1, UnaryOperatorSignature op2, BoundExpression operand, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 188BetterResult better = BetterConversionFromExpression(operand, op1.OperandType, op2.OperandType, ref useSiteInfo); 190if (better == BetterResult.Left || better == BetterResult.Right) 220return BetterResult.Right; 224return BetterResult.Left; 231return BetterResult.Left; 235return BetterResult.Right; 238return BetterResult.Neither;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (140)
1796var better = BetterFunctionMember(results[currentBestIndex], results[index], arguments.Arguments, ref useSiteInfo); 1797if (better == BetterResult.Right) 1802else if (better != BetterResult.Left) 1823var better = BetterFunctionMember(results[currentBestIndex], results[index], arguments.Arguments, ref useSiteInfo); 1824if (better != BetterResult.Left) 1994var better = BetterFunctionMember(c1Result, c2Result, arguments.Arguments, ref useSiteInfo); 1995if (better == BetterResult.Left) 1999else if (better == BetterResult.Right) 2034results[i] = BetterResult.Left == BetterFunctionMember(results[notBestIdx], results[i], arguments.Arguments, ref useSiteInfo) 2078private BetterResult BetterFunctionMember<TMember>( 2094return BetterResult.Left; 2096return BetterResult.Right; 2109return hasAnyRefOmittedArgument1 ? BetterResult.Right : BetterResult.Left; 2117private BetterResult BetterFunctionMember<TMember>( 2137BetterResult result = BetterResult.Neither; 2172BetterResult r; 2197if (r == BetterResult.Neither) 2214if (result == BetterResult.Neither) 2237result = BetterResult.Neither; 2258result = BetterResult.Neither; 2264Debug.Assert(result == BetterResult.Left || result == BetterResult.Right); 2271if (result != BetterResult.Neither) 2352return BetterResult.Right; 2358return BetterResult.Left; 2367return BetterResult.Left; 2371return BetterResult.Right; 2383return BetterResult.Left; 2388return BetterResult.Right; 2396return BetterResult.Left; 2401return BetterResult.Right; 2419return BetterResult.Left; 2424return BetterResult.Right; 2436return BetterResult.Left; 2441return BetterResult.Right; 2476if (result != BetterResult.Neither) 2496return BetterResult.Left; 2501return BetterResult.Right; 2510return (m1ModifierCount < m2ModifierCount) ? BetterResult.Left : BetterResult.Right; 2516if (result != BetterResult.Neither) 2546var betterResult = BetterParamsCollectionType(t1, t2, ref useSiteInfo); 2547if (betterResult != BetterResult.Neither) 2555return BetterResult.Neither; 2601private static BetterResult PreferValOverInOrRefInterpolatedHandlerParameters<TMember>( 2609BetterResult valOverInOrRefInterpolatedHandlerPreference = BetterResult.Neither; 2631if (valOverInOrRefInterpolatedHandlerPreference == BetterResult.Right) 2633return BetterResult.Neither; 2637valOverInOrRefInterpolatedHandlerPreference = BetterResult.Left; 2642if (valOverInOrRefInterpolatedHandlerPreference == BetterResult.Left) 2644return BetterResult.Neither; 2648valOverInOrRefInterpolatedHandlerPreference = BetterResult.Right; 2698private static BetterResult MoreSpecificType(ref TemporaryArray<TypeSymbol> t1, ref TemporaryArray<TypeSymbol> t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2705var result = BetterResult.Neither; 2708var r = MoreSpecificType(t1[i], t2[i], ref useSiteInfo); 2709if (r == BetterResult.Neither) 2713else if (result == BetterResult.Neither) 2723return BetterResult.Neither; 2730private static BetterResult MoreSpecificType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2740return BetterResult.Right; 2745return BetterResult.Left; 2750return BetterResult.Neither; 2784return BetterResult.Neither; 2799return BetterResult.Neither; 2812var result = MoreSpecificType(ref allTypeArgs1.AsRef(), ref allTypeArgs2.AsRef(), ref useSiteInfo); 2818private BetterResult BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2832private BetterResult BetterConversionFromExpression( 2871return conv1.Kind == ConversionKind.Identity ? BetterResult.Left : BetterResult.Neither; 2875return conv2.Kind == ConversionKind.Identity ? BetterResult.Right : BetterResult.Neither; 2880return BetterResult.Neither; 2888private BetterResult BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, Conversion conv1, TypeSymbol t2, Conversion conv2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool okToDowngradeToNeither) 2895return BetterResult.Neither; 2907return BetterResult.Neither; 2928return BetterResult.Neither; 2930return BetterResult.Left; 2932return BetterResult.Right; 2941return BetterResult.Left; 2943return BetterResult.Right; 2957okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Left, lambdaOpt, t1, t2, ref useSiteInfo, false); 2958return BetterResult.Left; 2963okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Right, lambdaOpt, t1, t2, ref useSiteInfo, false); 2964return BetterResult.Right; 2969return BetterResult.Left; 2971return BetterResult.Right; 2988return BetterResult.Left; 2993return BetterResult.Right; 2998return BetterResult.Right; 3000return BetterResult.Left; 3008private BetterResult BetterCollectionExpressionConversion( 3021return BetterResult.Left; 3025return BetterResult.Right; 3028return BetterResult.Neither; 3042private BetterResult BetterCollectionExpressionConversion( 3069return BetterResult.Left; 3071return BetterResult.Right; 3088var betterResult = BetterResult.Neither; 3099BetterResult elementBetterResult; 3109if (elementBetterResult == BetterResult.Neither) 3114if (betterResult != BetterResult.Neither) 3118return BetterResult.Neither; 3139return BetterResult.Left; 3143return BetterResult.Right; 3147return BetterResult.Neither; 3186private BetterResult BetterParamsCollectionType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 3412private BetterResult BetterConversionTargetCore( 3420return BetterResult.Neither; 3427private BetterResult BetterConversionTarget( 3439private BetterResult BetterConversionTargetCore( 3454return BetterResult.Neither; 3468return BetterResult.Neither; 3472okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Left, lambdaOpt, type1, type2, ref useSiteInfo, true); 3473return BetterResult.Left; 3478okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Right, lambdaOpt, type1, type2, ref useSiteInfo, true); 3479return BetterResult.Right; 3496return BetterResult.Neither; 3501return BetterResult.Neither; 3522BetterResult delegateResult = BetterResult.Neither; 3529delegateResult = BetterResult.Left; 3535delegateResult = BetterResult.Right; 3538if (delegateResult == BetterResult.Neither) 3551if (delegateResult == BetterResult.Left) 3555return BetterResult.Neither; 3558else if (delegateResult == BetterResult.Right && IsMethodGroupConversionIncompatibleWithDelegate(group, d2, conv2)) 3560return BetterResult.Neither; 3569return BetterResult.Neither; 3574return BetterResult.Neither; 3586return BetterResult.Left; 3591return BetterResult.Right; 3594return BetterResult.Neither; 3608private bool CanDowngradeConversionFromLambdaToNeither(BetterResult currentResult, UnboundLambda lambda, TypeSymbol type1, TypeSymbol type2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool fromTypeAnalysis) 3660Debug.Assert(currentResult == BetterResult.Right); 3665Debug.Assert(currentResult == BetterResult.Left);