title: F# Method overload resolution not as smart as C#?
body: <p>Say, I have</p>
  
  <pre><code>member this.Test (x: 'a) = printfn "generic"
                             1
  member this.Test (x: Object) = printfn "non generic"
                                 2
  </code></pre>
  
  <p>If I call it in C#</p>
  
  <pre><code>var a = test.Test(3);         // calls generic version
  var b = test.Test((object)3); // calls non generic version
  var c = test.Test&lt;object&gt;(3); // calls generic version
  </code></pre>
  
  <p>However, in F#</p>
  
  <pre><code>let d = test.Test(3);  // calls non generic version
  let e = test.Test&lt;int&gt;(3); // calls generic version
  </code></pre>
  
  <p>So I have to add type annotation so as to get the correct overloaded method. Is this true? If so, then why F# doesn't automatically resolve correctly given that the argument type is already inferred? (what is the order of F#'s overload resolution anyway? always favor <code>Object</code> than its inherited classes?)</p>
  
  <p>It is a bit dangerous if a method has both overloads, one of them takes argument as <code>Object</code> type  and the other one is generic and both return the same type. (like in this example, or <code>Assert.AreEqual</code> in unit testing), as then it is very much likely we get the wrong overloading without even notice (won't be any compiler error). Wouldn't it be a problem?</p>
  
  <p>Update:</p>
  
  <p>Could someone explain</p>
  
  <ul>
  <li><p>Why F# resolves <code>Assert.AreEqual(3, 5)</code> as <code>Assert.AreEqual(Object a, Object b)</code> but not <code>Assert.AreEqual&lt;T&gt;(T a, T b)</code></p></li>
  <li><p>But F# resolves <code>Array.BinarySearch([|2;3|], 2)</code> as <code>BinarySearch&lt;T&gt;(T[]array, T value)</code> but not <code>BinarySearch(Array array, Object value)</code></p></li>
  </ul>