Closed
Description
The following code snippet fails to compile
class Test {
trait E
trait Marker
def test(es: List[E]): List[E] = es.collect { case e: Marker => e }
}
-- Error: tests/allan/Test.scala:5:69 ------------------------------------------
5 | def test(es: List[E]): List[E] = es.collect { case e: Marker => e }
| ^
|Cannot construct a collection of type That
|
|where: That is a type variable with constraint <: scala.collection.immutable.List[Test.this.E]
| with elements of type Test.this.Marker based on a collection of type scala.collection.immutable.List[Test.this.E].