title: Method type confused when using self type
body: <p>Following code does not compile with Scala 2 (tested 2.13.7 and Scala 2.12.15):</p>
  <pre><code>trait AttributeBase
  
  trait Attribute extends AttributeBase {
    def name: String
  }
  
  trait Base {
    def attribute: AttributeBase
  }
  
  trait Derived { self: Base =&gt;
    
    def attribute: Attribute
    
    def name = attribute.name
  }
  </code></pre>
  <p>The code compiles fine with Scala 3. With Scala 2 the error is:</p>
  <blockquote>
  <p>value name is not a member of AttributeBase</p>
  </blockquote>
  <p>It compiles fine when <code>extends</code> is used instead of a self type:</p>
  <pre><code>trait Derived extends Base {
  </code></pre>
  <p>Another possible workaround is:</p>
  <pre><code>  def name = (this:Derived).attribute.name
  </code></pre>
  <p>Why is the type of <code>Derived.attributed</code> assumed to be <code>AttributeBase</code> and not <code>Attribute</code>? Is this a Scala compiler bug, or some Scala 2 limitation?</p>