aboutsummaryrefslogtreecommitdiff
path: root/tests/run/scala2mixins.scala
blob: 059e156f3582e7a8cbdc3f449d91c4ea0d330bab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import scala.collection.IndexedSeqOptimized
import scala.collection.mutable.Builder

object Test {
  class Name extends Seq[Int]
    with IndexedSeqOptimized[Int, Name] {
    val underlying = 0 to 10
    def length: Int = underlying.length

    def apply(idx: Int): Int = underlying(idx)

    override protected[this] def newBuilder: Builder[Int, Name] = ???

    override def seq = toCollection(this)

  }
  def main(args: Array[String]): Unit = {
    val n = new Name
    // need to make sure that super accessors were emitted
    // ends with calls super.endsWith if argument is not an IndexedSeq
    assert(n.endsWith(10 :: Nil))
  }
}