[mcs] Update better conversion tie breaking rules to cover candidate with longer...
[mono.git] / mcs / mcs / ecore.cs
index ad4faf3ce242d67a81f170f9c4620b757e438fac..8475a9e489428c0d98d91267b7b40954a54be3c2 100644 (file)
@@ -4781,12 +4781,18 @@ namespace Mono.CSharp {
 
                                //
                                // A candidate with no default parameters is still better when there
-                               // is no better expression conversion
+                               // is no better expression conversion and does not have more parameters
                                //
                                if (candidate_pd.Count < best_pd.Count) {
-                                       if (!candidate_params && !candidate_pd.FixedParameters [j - 1].HasDefaultValue) {
+                                       if (candidate_params)
+                                               return false;
+                                       
+                                       if (!candidate_pd.FixedParameters [j - 1].HasDefaultValue)
                                                return true;
-                                       }
+
+                                       if (best_pd.FixedParameters [j].HasDefaultValue)
+                                               return true;
+                                       
                                } else if (candidate_pd.Count == best_pd.Count) {
                                        if (candidate_params)
                                                return false;