class TestAnyVal(val e: Int) extends AnyVal {
}
class C {
def e(a: Any) = a match {
case c: C => this eq c
}
}
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Lukas’ answer is of course correct. Note that you can still get that optimization with 2.11 (or 2.10 for that matter), using -optimize:
public final boolean equals$extension(int, java.lang.Object);
Code:
0: aload_2
1: instanceof #31 // class TestAnyVal
4: ifeq 12
7: iconst_1
8: istore_3
9: goto 14
12: iconst_0
13: istore_3
14: iload_3
15: ifeq 45
18: aload_2
19: checkcast #31 // class TestAnyVal
22: invokevirtual #34 // Method TestAnyVal.e:()I
25: istore 4
27: iload_1
28: iload 4
30: if_icmpne 37
33: iconst_1
34: goto 38
37: iconst_0
38: ifeq 45
41: iconst_1
42: goto 46
45: iconst_0
46: ireturn