Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
tree.selector match {
case EmptyTree =>
val (protoFormals, _) = decomposeProtoFunction(pt, 1)
val unchecked = pt <:< defn.PartialFunctionType
val unchecked = pt.isRef(defn.PartialFunctionClass)
typed(desugar.makeCaseLambda(tree.cases, protoFormals.length, unchecked) withPos tree.pos, pt)
case _ =>
val sel1 = typedExpr(tree.selector)
Expand Down Expand Up @@ -2251,7 +2251,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
* tree that went unreported. A scenario where this happens is i1802.scala.
*/
def ensureReported(tp: Type) = tp match {
case err: ErrorType if !ctx.reporter.hasErrors => ctx.error(err.msg, tree.pos)
case err: ErrorType if !ctx.reporter.errorsReported => ctx.error(err.msg, tree.pos)
case _ =>
}

Expand Down
6 changes: 6 additions & 0 deletions tests/neg/ensureReported.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object AnonymousF {
val f = {
case l @ List(1) => // error: missing parameter type // error: Ambiguous overload
Some(l)
}
}
5 changes: 5 additions & 0 deletions tests/patmat/i3206.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Test {
val foo: PartialFunction[Option[Int], Int] = {
case Some(x) => x
}
}
1 change: 0 additions & 1 deletion tests/patmat/partial-function.check

This file was deleted.