Skip to content

Commit

Permalink
Fix rebase breakage
Browse files Browse the repository at this point in the history
The fix of scala#3627 got lost when merging the GADT subtype changes.
  • Loading branch information
odersky committed Feb 3, 2018
1 parent b42da43 commit e07af3f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {

private[this] var pendingSubTypes: mutable.Set[(Type, Type)] = null
private[this] var recCount = 0
private[this] var monitored = false

private[this] var needsGc = false

Expand Down Expand Up @@ -102,9 +103,11 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
if (tp2 eq NoType) return false
if ((tp2 eq tp1) || (tp2 eq WildcardType)) return true
try isSubType(tp1, tp2)
finally
finally {
monitored = false
if (Config.checkConstraintsSatisfiable)
assert(isSatisfiable, constraint.show)
}
}

private[this] var approx: ApproxState = NoApprox
Expand Down Expand Up @@ -284,6 +287,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
if (recur(info1.alias, tp2)) return true
if (tp1.prefix.isStable) return false
case _ =>
if (tp1 eq NothingType) return tp1 == tp2.bottomType
}
thirdTry
case tp1: TypeParamRef =>
Expand Down Expand Up @@ -837,9 +841,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
val savedSuccessCount = successCount
try {
recCount = recCount + 1
val result =
if (recCount < Config.LogPendingSubTypesThreshold) firstTry
else monitoredIsSubType
if (recCount >= Config.LogPendingSubTypesThreshold) monitored = true
val result = if (monitored) monitoredIsSubType else firstTry
recCount = recCount - 1
if (!result) state.resetConstraintTo(saved)
else if (recCount == 0 && needsGc) {
Expand Down

0 comments on commit e07af3f

Please sign in to comment.