-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:pattern-matchingarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etchelp wanteditype:enhancementstat:revisit
Description
Given:
trait Foo
class One extends Foo
class Two extends Foo
class Bla extends One
object Test {
def test(f: Foo) = f match {
case f: One =>
case f: Two =>
case f: Bla =>
}
}
We get the warning:
-- [E120] Only null matched Warning: try/caseun.scala:10:9 ---------------------
10 | case f: Bla =>
| ^^^^^^
| Only null is matched. Consider using `case null =>` instead.
This is confusing since it doesn't explain why only null
is matched. Here it's easy to see that this is because we matched on One
previously and that Bla
is a subtype of One
, but in a long series of case this might be very hard to understand. A better warning message would explain all of this.
Metadata
Metadata
Assignees
Labels
area:pattern-matchingarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etchelp wanteditype:enhancementstat:revisit