-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:pattern-matchingarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug
Description
Snippet below produces both warning and error at the same location. It should have produced a single error with assigned error code.
Compiler version
3.8.1-RC1-bin-20251221-327be51-NIGHTLY
Minimized code
case class A(a: Int)
case class B(b: Int)
case class C(c: Int)
val a = (A(1): A | B) match {
case A(_) => "OK"
case B(_) => "OK"
case C(_) => "Not OK"
}Output
scala compile no-error-codes -S 3.nightly --server=false
-- [E030] Match case Unreachable Warning: /Users/wmazur/projects/scala/scala3/no-error-codes/case1.scala:8:7
8 | case C(_) => "Not OK"
| ^^^^
| Unreachable case
-- Error: /Users/wmazur/projects/scala/scala3/no-error-codes/case1.scala:8:7 ---
8 | case C(_) => "Not OK"
| ^
| this case is unreachable since type A | B and class C are unrelated
1 warning found
1 error found
Expectation
It should have produced a single error with assigned error code.
Metadata
Metadata
Assignees
Labels
area:pattern-matchingarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug