- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.1k
 
Closed
Labels
area:inlinearea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug
Description
Compiler version
3.4.0
Minimized code
sealed abstract class Parent // The warning goes away if `sealed` is removed
class A extends Parent
class B extends Parent
inline def matchAs[T <: Parent](p: Parent): Unit = p match // The type bound is necessary
    case p: T =>
    case _ => println("unreachable case reached") // Warning here: "Unreachable case except for null [...]"
end matchAs
@main def main: Unit =
    matchAs[A](new B)
end mainOutput
Compilation Output
[warn] -- [E121] Pattern Match Warning: [...]/inline_poc/src/main/scala/poc.scala:9:9 
[warn] 9 |    case _ => println("unreachable case reached")
[warn]   |         ^
[warn]   |Unreachable case except for null (if this is intentional, consider writing case null => instead).
[warn] one warning foundRun Output
unreachable case reached
Expectation
No warning should be issued, since the case is reachable.
Notes
The following conditions are required to trigger the warning
Parentmust besealedTmust be upper bounded
The warning stays even when p is declared inline.
bishabosha
Metadata
Metadata
Assignees
Labels
area:inlinearea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug