diff options
author | Martin Odersky <odersky@gmail.com> | 2012-08-20 08:10:34 +0100 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-08-20 08:10:38 +0100 |
commit | cf9b7ae0867f594aba39984ac732fbd26ed12f51 (patch) | |
tree | 3d4035fda41f8f2bd84361fbca312693c8d2b6f2 /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | |
parent | c32b189a2a2575512d0dc8d91a400d773b53a7f0 (diff) | |
download | scala-cf9b7ae0867f594aba39984ac732fbd26ed12f51.tar.gz scala-cf9b7ae0867f594aba39984ac732fbd26ed12f51.tar.bz2 scala-cf9b7ae0867f594aba39984ac732fbd26ed12f51.zip |
Compilespeed improvements: Exists arguments and others
It turns out that exists is not inlinable, even if put into List.
We try to eliminate or hoist most closures passed to exists in Types.
There are some other small improvements as well.
--
(@gkossakowski): This commit contains also a fix to crasher
prepared by @paulp. I squashed that commit and kept the
test-case that came with it.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 601ceaaa53..9d0c5f400e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -124,7 +124,11 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R defaultMethodNames.toList.distinct foreach { name => val methods = clazz.info.findMember(name, 0L, METHOD, false).alternatives - val haveDefaults = methods filter (sym => sym.hasParamWhich(_.hasDefault) && !nme.isProtectedAccessorName(sym.name)) + def hasDefaultParam(tpe: Type): Boolean = tpe match { + case MethodType(params, restpe) => (params exists (_.hasDefault)) || hasDefaultParam(restpe) + case _ => false + } + val haveDefaults = methods filter (sym => hasDefaultParam(sym.info) && !nme.isProtectedAccessorName(sym.name)) if (haveDefaults.lengthCompare(1) > 0) { val owners = haveDefaults map (_.owner) |