title: Implicit parameters resolution from super trait
body: <p>I am trying use implicit parameters to "inject" a dependency into my classes like this:</p>
  
  <pre><code>trait Bar {
      def m:String
  }
  
  object Bar {
      implicit val objBar = new Bar{ val m = "from object" } 
  }
  
  trait FooTrait { 
      def aBar(implicit bar:Bar) = bar
      def go = { aBar.m }
  }
  </code></pre>
  
  <p>Here the compiler supplies the implicit argument to <code>FooTrait</code> from the implicit val in <code>Bar</code>'s companion object. So doing:</p>
  
  <pre><code>scala&gt; println((new FooTrait{}).go)
  from object
  </code></pre>
  
  <p>Gives me the result I expect. However, if I mix the FooTrait and another trait like:</p>
  
  <pre><code>trait SuperFoo {
      implicit val superBar = new Bar{ val m = "from super" }
  }
  </code></pre>
  
  <p>The result is the same:</p>
  
  <pre><code>scala&gt; println((new FooTrait with SuperFoo).go)
  from object
  </code></pre>
  
  <p>I thought that the compiler would look in the <code>SuperFoo</code> before trying to resolve the implicit argument by checking <code>Bar</code>'s companion object. This <a href="http://daily-scala.blogspot.se/2010/04/implicit-parameter-resolution.html" rel="nofollow noreferrer" title="Implicit parameter resolution">blog post</a> states:</p>
  
  <blockquote>
    <p>There are very strict rules for which implicit value is to be applied
    to a implicit parameter. A simple way to think about it is that the
    "closest" definition will be used. Local scope, enclosing class,
    parent class, companion object of the desired type.</p>
  </blockquote>
  
  <p>Am I missing something or is this a known limitation of scalas implicit parameters?</p>