211 references to BetterResult
Microsoft.CodeAnalysis.CSharp (211)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (16)
730return BetterResult.Equal; 737return BetterResult.Neither; 739return leftWins ? BetterResult.Left : BetterResult.Right; 769return BetterResult.Equal; 776return BetterResult.Neither; 778return leftWins ? BetterResult.Left : BetterResult.Right; 799private static int? UniqueBestValidIndex<T>(ImmutableArray<T> items, Func<T, bool> valid, Func<T, T, BetterResult> better) 824BetterResult result = better(candidateItem, currentItem); 826if (result == BetterResult.Equal) 831else if (result == BetterResult.Neither) 839else if (result == BetterResult.Right) 866BetterResult result = better(candidateItem, currentItem); 867if (result != BetterResult.Left && result != BetterResult.Equal)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (40)
1112var better = BetterOperator(candidates[i].Signature, candidates[j].Signature, left, right, ref useSiteInfo); 1113if (better == BetterResult.Left) 1117else if (better == BetterResult.Right) 1146var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo); 1147if (better == BetterResult.Right) 1152else if (better != BetterResult.Left) 1168var better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo); 1169if (better != BetterResult.Left) 1179private BetterResult BetterOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, BoundExpression left, BoundExpression right, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1185return (op1.Priority.GetValueOrDefault() < op2.Priority.GetValueOrDefault()) ? BetterResult.Left : BetterResult.Right; 1188BetterResult leftBetter = BetterConversionFromExpression(left, op1.LeftType, op2.LeftType, ref useSiteInfo); 1189BetterResult rightBetter = BetterConversionFromExpression(right, op1.RightType, op2.RightType, ref useSiteInfo); 1210if (leftBetter == BetterResult.Left && rightBetter != BetterResult.Right || 1211leftBetter != BetterResult.Right && rightBetter == BetterResult.Left) 1213return BetterResult.Left; 1216if (leftBetter == BetterResult.Right && rightBetter != BetterResult.Left || 1217leftBetter != BetterResult.Left && rightBetter == BetterResult.Right) 1219return BetterResult.Right; 1251BetterResult result = MoreSpecificOperator(op1, op2, ref useSiteInfo); 1252if (result == BetterResult.Left || result == BetterResult.Right) 1265return BetterResult.Right; 1269return BetterResult.Left; 1274BetterResult valOverInPreference; 1278valOverInPreference = BetterResult.Left; 1282valOverInPreference = BetterResult.Right; 1286valOverInPreference = BetterResult.Neither; 1291if (valOverInPreference == BetterResult.Right) 1293return BetterResult.Neither; 1297valOverInPreference = BetterResult.Left; 1302if (valOverInPreference == BetterResult.Left) 1304return BetterResult.Neither; 1308valOverInPreference = BetterResult.Right; 1315private BetterResult MoreSpecificOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1361BetterResult 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 (138)
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) 1986var better = BetterFunctionMember(c1Result, c2Result, arguments.Arguments, ref useSiteInfo); 1987if (better == BetterResult.Left) 1991else if (better == BetterResult.Right) 2026results[i] = BetterResult.Left == BetterFunctionMember(results[notBestIdx], results[i], arguments.Arguments, ref useSiteInfo) 2070private BetterResult BetterFunctionMember<TMember>( 2086return BetterResult.Left; 2088return BetterResult.Right; 2101return hasAnyRefOmittedArgument1 ? BetterResult.Right : BetterResult.Left; 2109private BetterResult BetterFunctionMember<TMember>( 2129BetterResult result = BetterResult.Neither; 2164BetterResult r; 2189if (r == BetterResult.Neither) 2206if (result == BetterResult.Neither) 2229result = BetterResult.Neither; 2250result = BetterResult.Neither; 2256Debug.Assert(result == BetterResult.Left || result == BetterResult.Right); 2263if (result != BetterResult.Neither) 2344return BetterResult.Right; 2350return BetterResult.Left; 2359return BetterResult.Left; 2363return BetterResult.Right; 2375return BetterResult.Left; 2380return BetterResult.Right; 2388return BetterResult.Left; 2393return BetterResult.Right; 2411return BetterResult.Left; 2416return BetterResult.Right; 2428return BetterResult.Left; 2433return BetterResult.Right; 2468if (result != BetterResult.Neither) 2488return BetterResult.Left; 2493return BetterResult.Right; 2502return (m1ModifierCount < m2ModifierCount) ? BetterResult.Left : BetterResult.Right; 2508if (result != BetterResult.Neither) 2538var betterResult = BetterParamsCollectionType(t1, t2, ref useSiteInfo); 2539if (betterResult != BetterResult.Neither) 2547return BetterResult.Neither; 2593private static BetterResult PreferValOverInOrRefInterpolatedHandlerParameters<TMember>( 2601BetterResult valOverInOrRefInterpolatedHandlerPreference = BetterResult.Neither; 2623if (valOverInOrRefInterpolatedHandlerPreference == BetterResult.Right) 2625return BetterResult.Neither; 2629valOverInOrRefInterpolatedHandlerPreference = BetterResult.Left; 2634if (valOverInOrRefInterpolatedHandlerPreference == BetterResult.Left) 2636return BetterResult.Neither; 2640valOverInOrRefInterpolatedHandlerPreference = BetterResult.Right; 2690private static BetterResult MoreSpecificType(ref TemporaryArray<TypeSymbol> t1, ref TemporaryArray<TypeSymbol> t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2697var result = BetterResult.Neither; 2700var r = MoreSpecificType(t1[i], t2[i], ref useSiteInfo); 2701if (r == BetterResult.Neither) 2705else if (result == BetterResult.Neither) 2715return BetterResult.Neither; 2722private static BetterResult MoreSpecificType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2732return BetterResult.Right; 2737return BetterResult.Left; 2742return BetterResult.Neither; 2776return BetterResult.Neither; 2791return BetterResult.Neither; 2804var result = MoreSpecificType(ref allTypeArgs1.AsRef(), ref allTypeArgs2.AsRef(), ref useSiteInfo); 2810private BetterResult BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2824private BetterResult BetterConversionFromExpression( 2863return conv1.Kind == ConversionKind.Identity ? BetterResult.Left : BetterResult.Neither; 2867return conv2.Kind == ConversionKind.Identity ? BetterResult.Right : BetterResult.Neither; 2872return BetterResult.Neither; 2880private BetterResult BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, Conversion conv1, TypeSymbol t2, Conversion conv2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool okToDowngradeToNeither) 2887return BetterResult.Neither; 2899return BetterResult.Neither; 2920return BetterResult.Neither; 2922return BetterResult.Left; 2924return BetterResult.Right; 2933return BetterResult.Left; 2935return BetterResult.Right; 2949okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Left, lambdaOpt, t1, t2, ref useSiteInfo, false); 2950return BetterResult.Left; 2955okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Right, lambdaOpt, t1, t2, ref useSiteInfo, false); 2956return BetterResult.Right; 2961return BetterResult.Left; 2963return BetterResult.Right; 2977return BetterResult.Right; 2979return BetterResult.Left; 2987private BetterResult BetterCollectionExpressionConversion( 3000return BetterResult.Left; 3004return BetterResult.Right; 3007return BetterResult.Neither; 3021private BetterResult BetterCollectionExpressionConversion( 3048return BetterResult.Left; 3050return BetterResult.Right; 3067var betterResult = BetterResult.Neither; 3078BetterResult elementBetterResult; 3088if (elementBetterResult == BetterResult.Neither) 3093if (betterResult != BetterResult.Neither) 3097return BetterResult.Neither; 3118return BetterResult.Left; 3122return BetterResult.Right; 3126return BetterResult.Neither; 3165private BetterResult BetterParamsCollectionType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 3391private BetterResult BetterConversionTargetCore( 3399return BetterResult.Neither; 3406private BetterResult BetterConversionTarget( 3418private BetterResult BetterConversionTargetCore( 3433return BetterResult.Neither; 3447return BetterResult.Neither; 3451okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Left, lambdaOpt, type1, type2, ref useSiteInfo, true); 3452return BetterResult.Left; 3457okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(BetterResult.Right, lambdaOpt, type1, type2, ref useSiteInfo, true); 3458return BetterResult.Right; 3475return BetterResult.Neither; 3480return BetterResult.Neither; 3501BetterResult delegateResult = BetterResult.Neither; 3508delegateResult = BetterResult.Left; 3514delegateResult = BetterResult.Right; 3517if (delegateResult == BetterResult.Neither) 3530if (delegateResult == BetterResult.Left) 3534return BetterResult.Neither; 3537else if (delegateResult == BetterResult.Right && IsMethodGroupConversionIncompatibleWithDelegate(group, d2, conv2)) 3539return BetterResult.Neither; 3548return BetterResult.Neither; 3553return BetterResult.Neither; 3565return BetterResult.Left; 3570return BetterResult.Right; 3573return BetterResult.Neither; 3587private bool CanDowngradeConversionFromLambdaToNeither(BetterResult currentResult, UnboundLambda lambda, TypeSymbol type1, TypeSymbol type2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool fromTypeAnalysis) 3639Debug.Assert(currentResult == BetterResult.Right); 3644Debug.Assert(currentResult == BetterResult.Left);