Closed scabug closed 6 years ago
Imported From: https://issues.scala-lang.org/browse/SI-9220?orig=1 Reporter: @milessabin Affected Versions: 2.11.6
@retronym said:
object Test {
trait Command
object Command {
sealed trait Execution extends Command
}
case class Buzz() extends Command.Execution
case class Door() extends Command.Execution
def foo(cmd: Command.Execution) = cmd match {
case x @ (_: Buzz) => ???
case x @ (_: Door) => ???
}
}
@retronym said: WIP: https://github.com/retronym/scala/tree/ticket/9220
This issue seams to be fixed in 2.12.
I'm unable to reproduce it in 2.10 or 2.11 either, though. That has me wondering if some special compiler flag is required, or what. (I do have -Xlint
enabled.)
@SethTisue Strange, I can reproduce it without any special flags in every version I tried except for 2.12.x
oh, never mind, I can reproduce it with Jason's version of the code.
and yup, fixed in 2.12
The following,
results in the following spurious unreachable code warning,
Unnesting the
Execution
trait from theCommand
companion object results in compilation without the complaint.