1
// this class's bytecode, compiled under -optimize is analyzed by the test
2
// method a's bytecode should be identical to method b's bytecode
3
// this is not the best test for shielding against regressing on this particular issue,
4
// but it sets the stage for checking the bytecode emitted by the pattern matcher and
5
// comparing it to manually tuned code using if/then/else etc.
7
case class Foo(x: Any, y: String)
11
case Foo(_: String, y) => y
14
// this method's body holds the tree that should be generated by the pattern matcher for method a (-Xprint:patmat)
15
// the test checks that bytecode for a and b is identical (modulo line numbers)
16
// we can't diff trees as they are quite different (patmat uses jumps to labels that cannot be expressed in source, for example)
17
// note that the actual tree is quite bad: we do an unnecessary null check, isInstanceOf and local val (x3)
18
// some of these will be fixed soon (the initial null check is for the scrutinee, which is harder to fix in patmat)
22
if (x1.x.isInstanceOf[String]) {
27
throw new MatchError(x1)
b'\\ No newline at end of file'