@@ -383,8 +383,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
383383 * prefix. If the result has another unsafe instantiation, raise an error.
384384 */
385385 private def healNonvariant [T <: Tree ](tree : T , pt : Type )(implicit ctx : Context ): T =
386- if (ctx.unsafeNonvariant == ctx.runId && tree.tpe.widen.hasUnsafeNonvariant) {
387- println(i " HEAL $tree" )
386+ if (ctx.unsafeNonvariant == ctx.runId && tree.tpe.widen.hasUnsafeNonvariant)
388387 tree match {
389388 case tree @ Select (qual, _) if ! qual.tpe.isStable =>
390389 val alt = typedSelect(tree, pt, Typed (qual, TypeTree (SkolemType (qual.tpe.widen))))
@@ -393,7 +392,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
393392 case _ =>
394393 ctx.error(ex " unsafe instantiation of type ${tree.tpe}" , tree.pos)
395394 tree
396- }}
395+ }
397396 else tree
398397
399398 def typedSelect (tree : untpd.Select , pt : Type )(implicit ctx : Context ): Tree = track(" typedSelect" ) {
@@ -2188,12 +2187,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
21882187 case _ =>
21892188 }
21902189 // try to fully instantiate type
2191- {
2192- val ictx = ctx.fresh.setNewTyperState
2193- val constraint = ictx.typerState.constraint
2194- if (isFullyDefined(wtp, force = ForceDegree .all)(ictx) &&
2195- ictx.typerState.constraint.ne(constraint)) {
2196- ictx.typerState.commit()
2190+ { val localCtx = ctx.fresh.setNewTyperState
2191+ val prevConstraint = localCtx.typerState.constraint
2192+ if (isFullyDefined(wtp, force = ForceDegree .all)(localCtx) &&
2193+ localCtx.typerState.constraint.ne(prevConstraint)) {
2194+ localCtx.typerState.commit()
21972195 return adapt(tree, pt, original)
21982196 }
21992197 }
0 commit comments