File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -2191,18 +2191,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
2191
2191
case SearchSuccess (inferred, _, _, _) =>
2192
2192
adapt(inferred, pt)(ctx.retractMode(Mode .ImplicitsEnabled ))
2193
2193
case failure : SearchFailure =>
2194
+ val prevConstraint = ctx.typerState.constraint
2194
2195
if (pt.isInstanceOf [ProtoType ] && ! failure.isInstanceOf [AmbiguousImplicits ]) tree
2195
- else {
2196
- // try to fully instantiate type
2197
- val nestedCtx = ctx.fresh.setNewTyperState
2198
- val prevConstraint = nestedCtx.typerState.constraint
2199
- if (isFullyDefined(wtp, force = ForceDegree .all)(nestedCtx) &&
2200
- nestedCtx.typerState.constraint.ne(prevConstraint)) {
2201
- nestedCtx.typerState.commit()
2202
- return adapt(tree, pt, original)
2203
- }
2204
- }
2205
- err.typeMismatch(tree, pt, failure)
2196
+ else if (isFullyDefined(wtp, force = ForceDegree .all) &&
2197
+ ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt, original)
2198
+ else err.typeMismatch(tree, pt, failure)
2206
2199
}
2207
2200
}
2208
2201
You can’t perform that action at this time.
0 commit comments