summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-11-24 14:27:53 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-11-24 21:46:51 +1000
commitf5f777e6ce94e4e105ee70463e63d2238dedd2be (patch)
treed72c3033dd718726b386eb7c427fb570acd11a5c /test
parent543ebf6a0a930ec9e85bba1a4ad6df26ba541e6e (diff)
downloadscala-f5f777e6ce94e4e105ee70463e63d2238dedd2be.tar.gz
scala-f5f777e6ce94e4e105ee70463e63d2238dedd2be.tar.bz2
scala-f5f777e6ce94e4e105ee70463e63d2238dedd2be.zip
DRY-er trees in pattern matcher code gen.
Rather than building a cascade of if/elses, push additional conditions into a conjunction in the condition of a single if/else. This is possible when emitting conditions for the list of arguments of a pattern. Here's an example of the improvement to post-pattern matcher trees: https://gist.github.com/retronym/0d8f7126157061d72b81 While we could try to rely on the optimizer to coalesce the repeated else clauses, it seems wasteful to emit the code in that way in the first place.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t6288.check14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check
index a032a10de6..67877fd56d 100644
--- a/test/files/run/t6288.check
+++ b/test/files/run/t6288.check
@@ -33,11 +33,8 @@
[175]case <synthetic> val x1: [175]Any = [175]"";
[175]case5()[195]{
[195]<synthetic> val o7: [195]Option[List[Int]] = [195][195]Case4.unapplySeq([195]x1);
- [195]if ([195]o7.isEmpty.unary_!)
- [195]if ([195][195][195][195]o7.get.!=([195]null).&&([195][195][195][195]o7.get.lengthCompare([195]1).==([195]0)))
- [208][208]matchEnd4([208]())
- else
- [195][195]case6()
+ [195]if ([195][195]o7.isEmpty.unary_!.&&([195][195][195][195]o7.get.!=([195]null).&&([195][195][195][195]o7.get.lengthCompare([195]1).==([195]0))))
+ [208][208]matchEnd4([208]())
else
[195][195]case6()
};
@@ -59,11 +56,8 @@
[273]case <synthetic> val x1: [273]Any = [273]"";
[273]case5()[293]{
[293]<synthetic> val o7: [293]Option[List[Int]] = [293][293]Case4.unapplySeq([293]x1);
- [293]if ([293]o7.isEmpty.unary_!)
- [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0)))
- [304][304]matchEnd4([304]())
- else
- [293][293]case6()
+ [293]if ([293][293]o7.isEmpty.unary_!.&&([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0))))
+ [304][304]matchEnd4([304]())
else
[293][293]case6()
};