@@ -421,6 +421,7 @@ trait Implicits { self: Typer =>
421
421
assert(! ctx.isAfterTyper,
422
422
if (argument.isEmpty) i " missing implicit parameter of type $pt after typer "
423
423
else i " type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}" )
424
+ val prevConstr = ctx.typerState.constraint
424
425
ctx.traceIndented(s " search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}" , implicits, show = true ) {
425
426
assert(! pt.isInstanceOf [ExprType ])
426
427
val isearch =
@@ -435,6 +436,7 @@ trait Implicits { self: Typer =>
435
436
val deepPt = pt.deepenProto
436
437
if (deepPt ne pt) inferImplicit(deepPt, argument, pos) else result
437
438
case _ =>
439
+ assert(prevConstr eq ctx.typerState.constraint)
438
440
result
439
441
}
440
442
}
@@ -450,7 +452,7 @@ trait Implicits { self: Typer =>
450
452
// Not clear whether we need to drop the `.widen` here. All tests pass with it in place, though.
451
453
452
454
assert(argument.isEmpty || argument.tpe.isValueType || argument.tpe.isInstanceOf [ExprType ],
453
- d " found: ${argument.tpe}, expected: $pt" )
455
+ d " found: $argument : $ {argument.tpe}, expected: $pt" )
454
456
455
457
/** The expected type for the searched implicit */
456
458
lazy val fullProto = implicitProto(pt, identity)
@@ -472,9 +474,11 @@ trait Implicits { self: Typer =>
472
474
473
475
/** Search a list of eligible implicit references */
474
476
def searchImplicits (eligible : List [TermRef ], contextual : Boolean ): SearchResult = {
477
+ val constr = ctx.typerState.constraint
475
478
476
479
/** Try to typecheck an implicit reference */
477
480
def typedImplicit (ref : TermRef )(implicit ctx : Context ): SearchResult = track(" typedImplicit" ) { ctx.traceIndented(i " typed implicit $ref, pt = $pt, implicitsEnabled == ${ctx.mode is ImplicitsEnabled }" , implicits, show = true ) {
481
+ assert(constr eq ctx.typerState.constraint)
478
482
var generated : Tree = tpd.ref(ref).withPos(pos)
479
483
if (! argument.isEmpty)
480
484
generated = typedUnadapted(
@@ -483,7 +487,7 @@ trait Implicits { self: Typer =>
483
487
val generated1 = adapt(generated, pt)
484
488
lazy val shadowing =
485
489
typed(untpd.Ident (ref.name) withPos pos.toSynthetic, funProto)
486
- (nestedContext.addMode(Mode .ImplicitShadowing ).setNewTyperState )
490
+ (nestedContext.addMode(Mode .ImplicitShadowing ).setExploreTyperState )
487
491
def refMatches (shadowing : Tree ): Boolean =
488
492
ref.symbol == closureBody(shadowing).symbol || {
489
493
shadowing match {
0 commit comments