summaryrefslogtreecommitdiff
path: root/test/files/pos/t927.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t927.scala')
-rw-r--r--test/files/pos/t927.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t927.scala b/test/files/pos/t927.scala
new file mode 100644
index 0000000000..c903f19867
--- /dev/null
+++ b/test/files/pos/t927.scala
@@ -0,0 +1,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] = List(1,2,3).iterator.toStream
+ assert(sum(str) == 6)
+
+}