Skip to content

Commit c9b093b

Browse files
committed
Simplify NoMatchingImplicit#clarify
1 parent 65e2aa2 commit c9b093b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,7 @@ object Implicits {
397397
* what was expected
398398
*/
399399
override def clarify(tp: Type)(implicit ctx: Context): Type = {
400-
val ctx0 = ctx
401-
locally {
402-
implicit val ctx = ctx0.fresh.setTyperState {
403-
val ts = ctx0.typerState.fresh()
404-
ts.constraint_=(constraint)(ctx0)
405-
ts
406-
}
400+
def replace(implicit ctx: Context): Type = {
407401
val map = new TypeMap {
408402
def apply(t: Type): Type = t match {
409403
case t: TypeParamRef =>
@@ -420,6 +414,10 @@ object Implicits {
420414
}
421415
map(tp)
422416
}
417+
418+
val ctx1 = ctx.fresh.setExploreTyperState()
419+
ctx1.typerState.constraint = constraint
420+
replace(ctx1)
423421
}
424422

425423
def explanation(implicit ctx: Context): String =

0 commit comments

Comments
 (0)