...

Text file src/github.com/alecthomas/chroma/v2/lexers/testdata/scala.actual

Documentation: github.com/alecthomas/chroma/v2/lexers/testdata

     1object abstractTypes extends Application {
     2  abstract class Buffer {
     3    type T; val element: T
     4  }
     5  abstract class SeqBuffer {
     6    type T; val element: Seq[T]; def length = element.length
     7  }
     8  def newIntBuffer(el: Int) = new Buffer {
     9    type T = Int; val element = el
    10  }
    11  def newIntBuffer(el: Int*) = new SeqBuffer {
    12    type T = Int; val element = el
    13  }
    14  println(newIntBuffer(1).element)
    15  println(newIntBuffer(1, 2, 3).length)
    16}

View as plain text