@@ -2398,19 +2398,21 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
23982398 }
23992399
24002400 /** Show subtype goal that led to an assertion failure */
2401- def showGoal (tp1 : Type , tp2 : Type )(using Context ): Unit = {
2402- report.echo(i " assertion failure for ${show(tp1)} <:< ${show(tp2)}, frozen = $frozenConstraint" )
2403- def explainPoly (tp : Type ) = tp match {
2404- case tp : TypeParamRef => report.echo(s " TypeParamRef ${tp.show} found in ${tp.binder.show}" )
2405- case tp : TypeRef if tp.symbol.exists => report.echo(s " typeref ${tp.show} found in ${tp.symbol.owner.show}" )
2406- case tp : TypeVar => report.echo(s " typevar ${tp.show}, origin = ${tp.origin}" )
2407- case _ => report.echo(s " ${tp.show} is a ${tp.getClass}" )
2408- }
2409- if (Config .verboseExplainSubtype) {
2410- explainPoly(tp1)
2411- explainPoly(tp2)
2412- }
2413- }
2401+ def showGoal (tp1 : Type , tp2 : Type )(using Context ): Unit =
2402+ try
2403+ report.echo(i " assertion failure for ${show(tp1)} <:< ${show(tp2)}, frozen = $frozenConstraint" )
2404+ def explainPoly (tp : Type ) = tp match {
2405+ case tp : TypeParamRef => report.echo(s " TypeParamRef ${tp.show} found in ${tp.binder.show}" )
2406+ case tp : TypeRef if tp.symbol.exists => report.echo(s " typeref ${tp.show} found in ${tp.symbol.owner.show}" )
2407+ case tp : TypeVar => report.echo(s " typevar ${tp.show}, origin = ${tp.origin}" )
2408+ case _ => report.echo(s " ${tp.show} is a ${tp.getClass}" )
2409+ }
2410+ if (Config .verboseExplainSubtype) {
2411+ explainPoly(tp1)
2412+ explainPoly(tp2)
2413+ }
2414+ catch case NonFatal (ex) =>
2415+ report.echo(s " assertion failure [[cannot display since $ex was thrown]] " )
24142416
24152417 /** Record statistics about the total number of subtype checks
24162418 * and the number of "successful" subtype checks, i.e. checks
0 commit comments