- if (!candidate_params && best_params)
- return true;
- if (candidate_params && !best_params)
- return false;
-
- int candidate_param_count = candidate_pd.Count;
- int best_param_count = best_pd.Count;
-
- if (candidate_param_count != best_param_count)
- // can only happen if (candidate_params && best_params)
- return candidate_param_count > best_param_count;
-
- //
- // now, both methods have the same number of parameters, and the parameters have the same types
- // Pick the "more specific" signature
- //
-
- MethodBase orig_candidate = TypeManager.DropGenericMethodArguments (candidate);
- MethodBase orig_best = TypeManager.DropGenericMethodArguments (best);
-
- ParameterData orig_candidate_pd = TypeManager.GetParameterData (orig_candidate);
- ParameterData orig_best_pd = TypeManager.GetParameterData (orig_best);
-
- bool specific_at_least_once = false;
- for (int j = 0; j < candidate_param_count; ++j) {
- Type ct = TypeManager.TypeToCoreType (orig_candidate_pd.ParameterType (j));
- Type bt = TypeManager.TypeToCoreType (orig_best_pd.ParameterType (j));
- if (ct.Equals (bt))
- continue;
- Type specific = MoreSpecific (ct, bt);
- if (specific == bt)
- return false;
- if (specific == ct)
- specific_at_least_once = true;
- }
-
- if (specific_at_least_once)
- return true;
-
- // FIXME: handle lifted operators
- // ...
-
- return false;