summaryrefslogblamecommitdiff
path: root/test/files/pos/bug927.scala
blob: 1a906cd9bc42e3301b0875ce56d5b3dc8aeed1bf (plain) (tree)
1
2
3
4
5
6
7
8

             
                                     



                                              
                                                                  


                       
object Test {

  def sum(stream: Stream[Int]): Int =
    stream match {
      case Stream.empty => 0
      case Stream.cons(hd, tl) => hd + sum(tl)
    }
  val str: Stream[Int] = Stream.fromIterator(List(1,2,3).elements)
  assert(sum(str) == 6)

}