summaryrefslogtreecommitdiff
path: root/test/files/pos/bug927.scala
blob: 8f3cdac20fea1b9b6e0067dc2fdfef8f3c5fe873 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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)
  
}