diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 14da2a95a23a..657f10564787 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -708,7 +708,6 @@ trait Implicits { self: Typer => assert(!ctx.isAfterTyper, if (argument.isEmpty) i"missing implicit parameter of type $pt after typer" else i"type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}") - val prevConstr = ctx.typerState.constraint trace(s"search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}", implicits, show = true) { assert(!pt.isInstanceOf[ExprType]) val isearch = @@ -737,7 +736,6 @@ trait Implicits { self: Typer => } else result case _ => - assert(prevConstr eq ctx.typerState.constraint) result } } diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 5757facc0029..095ccd29bdfe 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2224,11 +2224,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (isFullyDefined(wtp, force = ForceDegree.all) && ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt) else err.typeMismatch(tree, pt, failure) - if (ctx.mode.is(Mode.ImplicitsEnabled)) { - val nestedCtx = ctx.fresh.setNewTyperState() - inferView(tree, pt)(nestedCtx) match { + if (ctx.mode.is(Mode.ImplicitsEnabled)) + inferView(tree, pt) match { case SearchSuccess(inferred, _, _, _) => - nestedCtx.typerState.commit() adapt(inferred, pt)(ctx.retractMode(Mode.ImplicitsEnabled)) case failure: SearchFailure => if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits]) @@ -2238,7 +2236,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit tree else recover(failure) } - } else recover(NoImplicitMatches) }