summaryrefslogtreecommitdiff
path: root/test/files/pos/spec-super.scala
blob: 67179e0230217c543d73e22d75915f7a00993350 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import scala.collection.immutable._
import scala.collection.mutable.ListBuffer
import scala.collection.generic._

trait Base[+A] extends Traversable[A] {
  def add[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Base[A], B, That]): That = {
    val b = bf(this)
    b ++= this
    b ++= that
    b.result
  }

}

abstract class Derived[@specialized +A] extends Base[A] {
  override def add[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Base[A], B, That]): That = {
    val b = bf(this)
    super.add[B, That](that)
  }
}