Compiler version
3.3.7 - 3.8.1
Minimized code
sealed trait A
object A {
private abstract class B extends A
def ccc(oa: Option[A]) = oa match {
case Some(_) => println("match")
case None => println("no match")}
}
The warning appears only when all of these are true:
- A is sealed
- B is abstract
- B is private
Output
[info] compiling 1 Scala source to /home/.../reproduction/target/scala-3.7.4/classes ...
[warn] -- [E030] Match case Unreachable Warning: /home/.../reproduction/src/main/scala/Repro.scala:8:11
[warn] 8 | case Some(_) => println("reachable")
[warn] | ^^^^^^^
[warn] | Unreachable case
[warn] one warning found
[success] Total time: 2 s, completed 17.02.2026, 16:10:03
Expectation
No Unreachable case warning. case Some(_) is reachable because oa: Option[A] may contain a value of type A.