diff options
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 13 |
3 files changed, 28 insertions, 21 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 4ab911160..60a4df9fa 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -12,6 +12,7 @@ import Types._, Periods._, Flags._, Transformers._, Decorators._ import printing.Texts._ import printing.Printer import io.AbstractFile +import config.Config import Decorators.SymbolIteratorDecorator @@ -643,14 +644,15 @@ object Denotations { type AsSeenFromResult <: PreDenotation /** The denotation with info(s) as seen from prefix type */ - final def asSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult = { - if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) { - cachedAsSeenFrom = computeAsSeenFrom(pre) - cachedPrefix = pre - validAsSeenFrom = ctx.period - } - cachedAsSeenFrom - } + final def asSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult = + if (Config.cacheAsSeenFrom) { + if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) { + cachedAsSeenFrom = computeAsSeenFrom(pre) + cachedPrefix = pre + validAsSeenFrom = ctx.period + } + cachedAsSeenFrom + } else computeAsSeenFrom(pre) protected def computeAsSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index d6032aee3..af2e6a8ca 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -10,6 +10,7 @@ import collection.immutable.BitSet import scala.reflect.io.AbstractFile import Decorators.SymbolIteratorDecorator import annotation.tailrec +import config.Config trait SymDenotations { this: Context => import SymDenotations._ @@ -921,14 +922,15 @@ object SymDenotations { * The elements of the returned pre-denotation all * have existing symbols. */ - final def membersNamed(name: Name)(implicit ctx: Context): PreDenotation = { - var denots: PreDenotation = memberCache lookup name - if (denots == null) { - denots = computeMembersNamed(name) - memberCache enter (name, denots) - } - denots - } + final def membersNamed(name: Name)(implicit ctx: Context): PreDenotation = + if (Config.cacheMemberNames) { + var denots: PreDenotation = memberCache lookup name + if (denots == null) { + denots = computeMembersNamed(name) + memberCache enter (name, denots) + } + denots + } else computeMembersNamed(name) private def computeMembersNamed(name: Name)(implicit ctx: Context): PreDenotation = if (!classSymbol.hasChildren || (memberFingerPrint contains name)) { diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 27e177de6..14ebba57d 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -22,6 +22,7 @@ import transform.Erasure import printing.Printer import scala.util.hashing.{ MurmurHash3 => hashing } import collection.mutable +import config.Config object Types { @@ -416,7 +417,7 @@ object Types { final def member(name: Name)(implicit ctx: Context): Denotation = track("member-" + name) { try findMember(name, widenIfUnstable, EmptyFlags) catch { - case ex: Throwable => println(s"error occurred during: $this member $name"); throw ex // DEBUG + case ex: Throwable => println(s"error occurred during: $this: ${this.widen} member $name"); throw ex // DEBUG } } @@ -572,10 +573,12 @@ object Types { * - Or phase.erasedTypes is false and both types are neither method nor * poly types. */ - def matches(that: Type)(implicit ctx: Context): Boolean = track("matches") { - ctx.typeComparer.matchesType( - this, that, alwaysMatchSimple = !ctx.phase.erasedTypes) - } + def matches(that: Type)(implicit ctx: Context): Boolean = + if (Config.newMatch) this.signature == that.signature + else track("matches") { + ctx.typeComparer.matchesType( + this, that, alwaysMatchSimple = !ctx.phase.erasedTypes) + } /** The non-private symbol with given name in the given class that matches this type. * @param inClass The class containing the symbol's definition |