Skip to content

Commit e07af3f

Browse files
committed
Fix rebase breakage
The fix of #3627 got lost when merging the GADT subtype changes.
1 parent b42da43 commit e07af3f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
2525

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

2930
private[this] var needsGc = false
3031

@@ -102,9 +103,11 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
102103
if (tp2 eq NoType) return false
103104
if ((tp2 eq tp1) || (tp2 eq WildcardType)) return true
104105
try isSubType(tp1, tp2)
105-
finally
106+
finally {
107+
monitored = false
106108
if (Config.checkConstraintsSatisfiable)
107109
assert(isSatisfiable, constraint.show)
110+
}
108111
}
109112

110113
private[this] var approx: ApproxState = NoApprox
@@ -284,6 +287,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
284287
if (recur(info1.alias, tp2)) return true
285288
if (tp1.prefix.isStable) return false
286289
case _ =>
290+
if (tp1 eq NothingType) return tp1 == tp2.bottomType
287291
}
288292
thirdTry
289293
case tp1: TypeParamRef =>
@@ -837,9 +841,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
837841
val savedSuccessCount = successCount
838842
try {
839843
recCount = recCount + 1
840-
val result =
841-
if (recCount < Config.LogPendingSubTypesThreshold) firstTry
842-
else monitoredIsSubType
844+
if (recCount >= Config.LogPendingSubTypesThreshold) monitored = true
845+
val result = if (monitored) monitoredIsSubType else firstTry
843846
recCount = recCount - 1
844847
if (!result) state.resetConstraintTo(saved)
845848
else if (recCount == 0 && needsGc) {

0 commit comments

Comments
 (0)