Closed
Description
Compiling the following code:
trait X {
case class Foo();
object Bar {
def unapply(foo:Foo):Boolean = false;
}
}
object Y extends X {
val foo = Foo()
foo match {
case Bar() => println("matched bar!");
}
}
produces a type mismatch with the following message:
<console>:8: error: type mismatch;
found : Y.this.Foo
required: X.this.Foo
case Bar() => println("matched bar!");
^
But if instead of an object, we make a subclass with the same exact code, as in:
class Z extends X {
val foo = Foo()
foo match {
case Bar() => println("matched bar!");
}
}
It compiles and runs normally.
Also, the same code does not present any errors either in 2.6.0-RC1 or in 2.5.1.
Metadata
Metadata
Assignees
Labels
No labels