Skip to content

Commit c3bb79d

Browse files
committed
Fix reporting of errors from ErrorTrees
Reporter#hasErrors only checks the current Reporter, we need to use Reporter#errorsReported to take into account errors from outer Reporters.
1 parent 17fe03a commit c3bb79d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
22512251
* tree that went unreported. A scenario where this happens is i1802.scala.
22522252
*/
22532253
def ensureReported(tp: Type) = tp match {
2254-
case err: ErrorType if !ctx.reporter.hasErrors => ctx.error(err.msg, tree.pos)
2254+
case err: ErrorType if !ctx.reporter.errorsReported => ctx.error(err.msg, tree.pos)
22552255
case _ =>
22562256
}
22572257

tests/neg/ensureReported.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object AnonymousF {
2+
val f = {
3+
case l @ List(1) => // error: missing parameter type // error: Ambiguous overload
4+
Some(l)
5+
}
6+
}

0 commit comments

Comments
 (0)