-
Notifications
You must be signed in to change notification settings - Fork 380
Open
Description
Hi,
I am following this tutorial. Awesome work. However, I couldn't get this example working with the code provided.
trait Stream[+T] {
def prepend[U >: T](elem: U) : Stream[U] = Stream.cons(elem, this)
}
Compiling the code above gives me error as following.
polymorphism.scala:15: error: type mismatch;
found : Stream[T]
required: scala.collection.immutable.Stream[?]
def prepend[U >: T](elem: U) : Stream[U] = Stream.cons(elem, this)
Did I miss something?
exercises-scalatutorial/src/main/scala/scalatutorial/sections/PolymorphicTypes.scala
Line 433 in 38531b1
* def prepend [U >: T](elem: U): Stream[U] = Stream.cons(elem, this) |
Metadata
Metadata
Assignees
Labels
No labels