File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2224,9 +2224,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
2224
2224
if (isFullyDefined(wtp, force = ForceDegree .all) &&
2225
2225
ctx.typerState.constraint.ne(prevConstraint)) adapt(tree, pt)
2226
2226
else err.typeMismatch(tree, pt, failure)
2227
- if (ctx.mode.is(Mode .ImplicitsEnabled ))
2228
- inferView(tree, pt) match {
2227
+ if (ctx.mode.is(Mode .ImplicitsEnabled )) {
2228
+ val nestedCtx = ctx.fresh.setNewTyperState()
2229
+ inferView(tree, pt)(nestedCtx) match {
2229
2230
case SearchSuccess (inferred, _, _, _) =>
2231
+ nestedCtx.typerState.commit()
2230
2232
adapt(inferred, pt)(ctx.retractMode(Mode .ImplicitsEnabled ))
2231
2233
case failure : SearchFailure =>
2232
2234
if (pt.isInstanceOf [ProtoType ] && ! failure.isInstanceOf [AmbiguousImplicits ])
@@ -2236,6 +2238,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
2236
2238
tree
2237
2239
else recover(failure)
2238
2240
}
2241
+ }
2239
2242
else recover(NoImplicitMatches )
2240
2243
}
2241
2244
Original file line number Diff line number Diff line change
1
+ class Test {
2
+ import Test .test
3
+ " Hello" .toto // error
4
+ }
5
+
6
+ object Test {
7
+ def test = {
8
+ implicitly[collection.generic.CanBuildFrom [List [Int ], Int , List [Int ]]]
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments