Skip to content

Commit 67954fe

Browse files
committed
Refine instantiation scheme
Commit only if the adapt following the instantiation is error-free. DottyLanguageServer had a compilation failure due to the previous scheme.
1 parent b1dac36 commit 67954fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,8 +2191,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
21912191
val prevConstraint = localCtx.typerState.constraint
21922192
if (isFullyDefined(wtp, force = ForceDegree.all)(localCtx) &&
21932193
localCtx.typerState.constraint.ne(prevConstraint)) {
2194-
localCtx.typerState.commit()
2195-
return adapt(tree, pt, original)
2194+
val tree1 = adapt(tree, pt, original)(localCtx)
2195+
if (!localCtx.reporter.hasErrors) {
2196+
localCtx.typerState.commit()
2197+
return tree1
2198+
}
21962199
}
21972200
}
21982201
// try an implicit conversion

0 commit comments

Comments
 (0)