title: Why is reference to overloaded definition ambiguous when types are known?
body: <p>I have a function like so:</p>
  
  <pre><code>def ifSome[B, _](pairs:(Option[B], B =&gt; _)*) {
    for((paramOption, setFunc) &lt;- pairs)
      for(someParam &lt;- paramOption) setFunc(someParam)
  }
  </code></pre>
  
  <p>and overloaded functions like these:</p>
  
  <pre><code>class Foo{ 
    var b=""
    def setB(b:String){this.b = b}
    def setB(b:Int){this.b = b.toString}
  }
  
  val f = new Foo
  </code></pre>
  
  <p>then the following line produces an error:</p>
  
  <pre><code>ifSome(Option("hi") -&gt; f.setB _)
  
  &lt;console&gt;:11: error: ambiguous reference to overloaded definition,
  both method setB in class Foo of type (b: Int)Unit
  and  method setB in class Foo of type (b: String)Unit
  match expected type ?
                   ifSome(Option("hi") -&gt; f.setB _)
  </code></pre>
  
  <p>But the compiler knows that we're looking for a Function1[java.lang.String, _], so why should the presence of a Function1[Int, _] present any confusion? Am I missing something or is this a compiler bug (or perhaps it should be a feature request)?</p>
  
  <p>I was able to workaround this by using a type annotation like so</p>
  
  <pre><code>ifSome(Option("hi") -&gt; (f.setB _:String=&gt;Unit))
  </code></pre>
  
  <p>but I'd like to understand why this is necessary.</p>