@@ -207,38 +207,32 @@ class TypeComparer(initctx: Context) extends DotClass {
207
207
else {
208
208
val saved = constraint
209
209
val savedSuccessCount = successCount
210
- val savedTotalCount = totalCount
211
- // if (Stats.monitored) Stats.record(s"isSubType ${tp1.show} <:< ${tp2.show}")
212
210
try {
213
- recCount += 1
214
- /* !!! DEBUG
215
- if (isWatched(tp1) && isWatched(tp2) && !(this.isInstanceOf[ExplainingTypeComparer])) {
216
- val explained = new ExplainingTypeComparer(ctx)
217
- println("***** watched:")
218
- println(TypeComparer.explained(_.typeComparer.isSubType(tp1, tp2)))
219
- }
220
- */
211
+ recCount = recCount + 1
221
212
val result =
222
213
if (recCount < LogPendingSubTypesThreshold ) firstTry(tp1, tp2)
223
214
else monitoredIsSubType(tp1, tp2)
224
- successCount += 1
225
- totalCount += 1
226
- recCount -= 1
227
- if (! result) {
228
- constraint = saved
229
- successCount = savedSuccessCount
230
- }
231
- else if (recCount == 0 ) {
232
- if (needsGc) state.gc()
233
- Stats .record(" successful subType" , successCount)
234
- Stats .record(" total subType" , totalCount)
235
- successCount = 0
236
- totalCount = 0
215
+ recCount = recCount - 1
216
+ if (! result) constraint = saved
217
+ else if (recCount == 0 && needsGc) state.gc()
218
+
219
+ def recordStatistics = {
220
+ // Stats.record(s"isSubType ${tp1.show} <:< ${tp2.show}")
221
+ totalCount += 1
222
+ if (result) successCount += 1 else successCount = savedSuccessCount
223
+ if (recCount == 0 ) {
224
+ Stats .record(" successful subType" , successCount)
225
+ Stats .record(" total subType" , totalCount)
226
+ successCount = 0
227
+ totalCount = 0
228
+ }
237
229
}
230
+ if (Stats .monitored) recordStatistics
231
+
238
232
result
239
233
} catch {
240
234
case ex : Throwable =>
241
- if (ex. isInstanceOf [ AssertionError ]) { // !!!DEBUG
235
+ def showState = {
242
236
println(disambiguated(implicit ctx => s " assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint" ))
243
237
def explainPoly (tp : Type ) = tp match {
244
238
case tp : PolyParam => println(s " polyparam ${tp.show} found in ${tp.binder.show}" )
@@ -249,6 +243,7 @@ class TypeComparer(initctx: Context) extends DotClass {
249
243
explainPoly(tp1)
250
244
explainPoly(tp2)
251
245
}
246
+ if (ex.isInstanceOf [AssertionError ]) showState
252
247
recCount -= 1
253
248
constraint = saved
254
249
successCount = savedSuccessCount
0 commit comments