Skip to content

Commit 4a1777c

Browse files
committed
Fix logic for handling extension methods in Typer
1 parent cddb427 commit 4a1777c

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
@@ -3509,12 +3509,13 @@ class Typer extends Namer
35093509
try
35103510
val nestedCtx = ctx.fresh.setNewTyperState()
35113511
val app = tryExtension(using nestedCtx)
3512-
if !app.isEmpty then
3512+
if !app.isEmpty && !nestedCtx.reporter.hasErrors then
3513+
nestedCtx.typerState.commit()
3514+
return ExtMethodApply(app)
3515+
else
35133516
nestedCtx.reporter.allErrors
35143517
.filterNot(_.msg.isInstanceOf[NotAnExtensionMethod]) match
35153518
case Nil =>
3516-
nestedCtx.typerState.commit()
3517-
return ExtMethodApply(app)
35183519
case err :: _ =>
35193520
rememberSearchFailure(tree,
35203521
SearchFailure(app.withType(FailedExtension(app, pt, err.msg))))

0 commit comments

Comments
 (0)