diff options
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 17 |
3 files changed, 17 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 88923d31d..c1b2e20eb 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -165,6 +165,14 @@ object Contexts { _typeComparer } + /** Number of findMember calls on stack */ + private[core] var findMemberCount: Int = 0 + + /** List of names which have a findMemberCall on stack, + * after Config.LogPendingFindMemberThreshold is reached. + */ + private[core] var pendingMemberSearches: List[Name] = Nil + /** The new implicit references that are introduced by this scope */ private var implicitsCache: ContextualImplicits = null def implicits: ContextualImplicits = { diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 6aee47945..069525db0 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -25,9 +25,6 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi private var pendingSubTypes: mutable.Set[(Type, Type)] = null private var recCount = 0 - private[core] var findMemberCount = 0 - private[core] var pendingMemberSearches: List[Name] = Nil - private var needsGc = false /** Is a subtype check in progress? In that case we may not diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 476ea3841..ae9088f00 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -455,7 +455,7 @@ object Types { val jointInfo = if (rinfo.isAlias) rinfo else if (pdenot.info.isAlias) pdenot.info - else if (ctx.typeComparer.pendingMemberSearches.contains(name)) safeAnd(pdenot.info, rinfo) + else if (ctx.pendingMemberSearches.contains(name)) safeAnd(pdenot.info, rinfo) else pdenot.info & rinfo pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, jointInfo) } else @@ -493,12 +493,12 @@ object Types { case _ => tp1 & tp2 } - val cmp = ctx.typeComparer - val recCount = cmp.findMemberCount - cmp.findMemberCount = recCount + 1 - if (recCount >= Config.LogPendingFindMemberThreshold) { - cmp.pendingMemberSearches = name :: cmp.pendingMemberSearches + { val recCount = ctx.findMemberCount + 1 + ctx.findMemberCount = recCount + if (recCount >= Config.LogPendingFindMemberThreshold) + ctx.pendingMemberSearches = name :: ctx.pendingMemberSearches } + try go(this) catch { case ex: MergeError => @@ -508,9 +508,10 @@ object Types { throw ex // DEBUG } finally { - cmp.findMemberCount = recCount - 1 + val recCount = ctx.findMemberCount if (recCount >= Config.LogPendingFindMemberThreshold) - cmp.pendingMemberSearches = cmp.pendingMemberSearches.tail + ctx.pendingMemberSearches = ctx.pendingMemberSearches.tail + ctx.findMemberCount = recCount - 1 } } |