title: Strange type mismatch when using member access instead of extractor
body: <p>Given a tuple with elements of type <code>A</code> and another type parametrised in <code>A</code>:</p>
  
  <pre><code>trait Writer[-A] { def write(a: A): Unit }
  case class Write[A](value: A, writer: Writer[A])
  </code></pre>
  
  <p>And a use site:</p>
  
  <pre><code>trait Cache { def store[A](value: A, writer: Writer[A]): Unit }
  </code></pre>
  
  <p>Why does the following work as expected, using the tuple's extractor:</p>
  
  <pre><code>def test1(set: Set[Write[_]], cache: Cache): Unit =
    set.foreach {
      case Write(value, writer) =&gt; cache.store(value, writer)
    }
  </code></pre>
  
  <p>But the following fails:</p>
  
  <pre><code>def test2(set: Set[Write[_]], cache: Cache ): Unit =
    set.foreach { write =&gt;
      cache.store(write.value, write.writer)
    }
  </code></pre>
  
  <p>with error message </p>
  
  <pre><code> found   : Writer[_$1] where type _$1
   required: Writer[Any]
               cache.store(write.value, write.writer)
                                          ^
  </code></pre>
  
  <p>Can I fix the second form (<code>test2</code>) to compile properly?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Departing from the ideas by Owen I tried out if I can make it work without pattern matching at all (which is what I wanted in the first place). Here are two more strange cases, one working, the other not:</p>
  
  <pre><code>// does not work
  def test3(set: Set[Write[_]], cache: Cache): Unit = {
    def process[A](write: Write[A]): Unit =
      cache.store(write.value, write.writer)
  
    set.foreach(process)
  }
  
  // _does work_
  def test4(set: Set[Write[_]], cache: Cache): Unit = {
    def process[A](write: Write[A]): Unit =
      cache.store(write.value, write.writer)
  
    set.foreach(w =&gt; process(w))
  }
  </code></pre>
  
  <p>Still pretty obscure to me...</p>