Skip to content

Commit 91b874b

Browse files
authored
Merge pull request #3374 from dotty-staging/revert-3348
Revert #3348: remove assertion as completion may happen in inferImplicit
2 parents ec05239 + f0c2518 commit 91b874b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ trait Implicits { self: Typer =>
708708
assert(!ctx.isAfterTyper,
709709
if (argument.isEmpty) i"missing implicit parameter of type $pt after typer"
710710
else i"type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}")
711-
val prevConstr = ctx.typerState.constraint
712711
trace(s"search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}", implicits, show = true) {
713712
assert(!pt.isInstanceOf[ExprType])
714713
val isearch =
@@ -737,7 +736,6 @@ trait Implicits { self: Typer =>
737736
}
738737
else result
739738
case _ =>
740-
assert(prevConstr eq ctx.typerState.constraint)
741739
result
742740
}
743741
}

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,11 +2224,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22242224
if (isFullyDefined(wtp, force = ForceDegree.all) &&
22252225
ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt)
22262226
else err.typeMismatch(tree, pt, failure)
2227-
if (ctx.mode.is(Mode.ImplicitsEnabled)) {
2228-
val nestedCtx = ctx.fresh.setNewTyperState()
2229-
inferView(tree, pt)(nestedCtx) match {
2227+
if (ctx.mode.is(Mode.ImplicitsEnabled))
2228+
inferView(tree, pt) match {
22302229
case SearchSuccess(inferred, _, _, _) =>
2231-
nestedCtx.typerState.commit()
22322230
adapt(inferred, pt)(ctx.retractMode(Mode.ImplicitsEnabled))
22332231
case failure: SearchFailure =>
22342232
if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits])
@@ -2238,7 +2236,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22382236
tree
22392237
else recover(failure)
22402238
}
2241-
}
22422239
else recover(NoImplicitMatches)
22432240
}
22442241

0 commit comments

Comments
 (0)