Open
Description
Compiler version
Tested 3.4.2, 3.4.1, 3.4.0, 3.3.3, all with the same issue.
2.13.14 works fine and does not emit warning.
Minimized example
def f: Unit = {
class A {
override def equals(x: Any): Boolean = x match {
case a: A => true
case _ => false
}
}
}
Output Error/Warning message
1 warning found
def f: Unit
-- [E092] Pattern Match Unchecked Warning: -------------------------------------
4 | case a: A => true
| ^
|the type test for A cannot be checked at runtime because it's a local class
|
| longer explanation available when compiling with `-explain`
Why this Error/Warning was not helpful
The code seems correct and runs correctly, i.e. the type test executes correctly at runtime, contradictory to the warning.
Suggested improvement
No warning should be emitted.