blob: de0ba4fe1d14358243cfe73b3028ef4512c2ad84 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
case class Foo()
object Test {
def main(args: Array[String]): Unit = {
assert(Foo.unapply(Foo()) == true)
// unapply generate by scalac are `_ != null`,
// dotty returns true in all cases
assert(Foo.unapply(null) == true)
Foo() match {
case Foo() => ()
case _ => ???
}
Foo() match {
case _: Foo => ()
case _ => ???
}
(Foo(): Any) match {
case Foo() => ()
case _ => ???
}
}
}
|