summaryrefslogblamecommitdiff
path: root/test/files/pos/bug927.scala
blob: 7d4c59d94c86d2573cabd99e2db4481b114b3bf0 (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).iterator)
  assert(sum(str) == 6)

}