From 71ea3e8278aad030cbe8c9093fe49790a4e419cb Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 25 Jan 2013 14:16:27 -0800 Subject: no null check for type-tested unapply arg pattern matching on case classes where pattern is not known to be a subclass of the unapply's argument type used to result in code like: ``` if (x1.isInstanceOf[Foo]) { val x2 = x1.asInstanceOf[Foo] if (x2 != null) { // redundant ... } } ``` this wastes byte code on the redundant null check with this patch, when previous type tests imply the variable cannot be null, there's no null check --- test/files/jvm/patmat_opt_no_nullcheck.check | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/files/jvm/patmat_opt_no_nullcheck.check (limited to 'test/files/jvm/patmat_opt_no_nullcheck.check') diff --git a/test/files/jvm/patmat_opt_no_nullcheck.check b/test/files/jvm/patmat_opt_no_nullcheck.check new file mode 100644 index 0000000000..43f53aba12 --- /dev/null +++ b/test/files/jvm/patmat_opt_no_nullcheck.check @@ -0,0 +1 @@ +bytecode identical -- cgit v1.2.3