Skip to content

Commit d6c62dd

Browse files
committed
Fix logic for handling extension methods in Typer
1 parent 0e2dde6 commit d6c62dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,12 +3512,13 @@ class Typer extends Namer
35123512
try
35133513
val nestedCtx = ctx.fresh.setNewTyperState()
35143514
val app = tryExtension(using nestedCtx)
3515-
if !app.isEmpty then
3515+
if !app.isEmpty && !nestedCtx.reporter.hasErrors then
3516+
nestedCtx.typerState.commit()
3517+
return ExtMethodApply(app)
3518+
else
35163519
nestedCtx.reporter.allErrors
35173520
.filterNot(_.msg.isInstanceOf[NotAnExtensionMethod]) match
35183521
case Nil =>
3519-
nestedCtx.typerState.commit()
3520-
return ExtMethodApply(app)
35213522
case err :: _ =>
35223523
rememberSearchFailure(tree,
35233524
SearchFailure(app.withType(FailedExtension(app, pt, err.msg))))

0 commit comments

Comments
 (0)