diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-19 17:02:19 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-21 18:42:50 +0100 |
commit | f2564f5ec6bd875b833ee3c0f509f3200f2e2362 (patch) | |
tree | 2c967ce1b860bdf2086814f87e36519b3b8c5fb3 /src/dotty/tools/dotc/typer/Inferencing.scala | |
parent | f699ba201bafccc66657a2765f280a226fcd9e55 (diff) | |
download | dotty-f2564f5ec6bd875b833ee3c0f509f3200f2e2362.tar.gz dotty-f2564f5ec6bd875b833ee3c0f509f3200f2e2362.tar.bz2 dotty-f2564f5ec6bd875b833ee3c0f509f3200f2e2362.zip |
Performance improvement: inline hasAltWith
Gives us ~1%, it seems.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 75316da59..2ca0313d1 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -79,7 +79,11 @@ object Inferencing { override def isMatchedBy(tp1: Type)(implicit ctx: Context) = { name == nme.WILDCARD || { val mbr = tp1.member(name) - mbr.exists && mbr.hasAltWith(m => compat.normalizedCompatible(m.info, memberProto)) + def qualifies(m: SingleDenotation) = compat.normalizedCompatible(m.info, memberProto) + mbr match { // hasAltWith inlined for performance + case mbr: SingleDenotation => mbr.exists && qualifies(mbr) + case _ => mbr hasAltWith qualifies + } } } |