title: Behaviour of super in chained Scala traits
body: <p>Why does <code>x.func</code> below return <code>"B extends B extends B"</code>?
  How to arrange this code so that it returns <code>"B extends A extends Base"</code>?</p>
  
  <pre><code>trait Base {
    def name = "Base"
    def func = name
  }
  
  trait A extends Base {
    override def name = "A"
    override def func = name + " extends " + super.func
  }
  
  trait B extends Base {
    override def name = "B"
    override def func = name + " extends " + super.func
  }
  
  val x = new Base with A with B
  println(x.func)
  </code></pre>
  
  <p>Update: One arrangement could be as follows. It now has identical definitions of <code>func1</code> in <code>A</code> and <code>B</code>. It does not work if I try to move it to the <code>Derived</code> class. Any ideas how to remove the repetition of <code>func1</code>?</p>
  
  <pre><code>trait Base {
    def name = "Base"
    def func1(s: String) = s
  }
  
  trait Derived extends Base {
    def func = func1(name)
  }
  
  trait A extends Derived {
    override def func1(s: String) = s + " extends " + super.func1(super.name)
    override def name = "A"
  }
  
  trait B extends Derived {
    override def func1(s: String) = s + " extends " + super.func1(super.name)
    override def name = "B"
  }
  
  val x = new Base with A with B
  println(x.func)
  </code></pre>