blob: c9cc85cec69d86ccb798e10caa609f13468c2359 (
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
27
28
29
|
object Test {
class A {
val d = 55
def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match {
case b => println("matched b")
case c => println("matched c")
case d => println("matched d")
case _ => println("matched neither")
}
def correctExample[A, B, C](a: A, b: B, c: C): Unit = a match {
case `b` => println("matched b")
case `c` => println("matched c")
case `d` => println("matched d")
case _ => println("matched neither")
}
def f[A](a: A) = {
def g[B](b: B) = {
def h[C](c: C) = a match {
case b => 1
case c => 2
case _ => 3
}
}
}
}
}
|