//
// 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;
--- /dev/null
+using System;
+
+internal class Program
+{
+ public static void Main ()
+ {
+ AttributeOrDefault ("firstItem", null);
+ }
+
+ public static string AttributeOrDefault (string attribute, string defaultValue = null)
+ {
+ return "";
+ }
+
+ public static string AttributeOrDefault (string attribute, bool? klass, string defaultValue = null)
+ {
+ throw new ApplicationException ();
+ }
+}
</method>
</type>
</test>
+ <test name="gtest-optional-40.cs">
+ <type name="Program">
+ <method name="Void Main()" attrs="150">
+ <size>14</size>
+ </method>
+ <method name="System.String AttributeOrDefault(System.String, System.String)" attrs="150">
+ <size>14</size>
+ </method>
+ <method name="System.String AttributeOrDefault(System.String, System.Nullable`1[System.Boolean], System.String)" attrs="150">
+ <size>7</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-partial-01.cs">
<type name="B`1[U]">
<method name="Void .ctor()" attrs="6278">