Skip to content

Commit 17fe03a

Browse files
committed
Fix #3206: make sure partial function has @unchecked
1 parent 223aa2a commit 17fe03a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
878878
tree.selector match {
879879
case EmptyTree =>
880880
val (protoFormals, _) = decomposeProtoFunction(pt, 1)
881-
val unchecked = pt <:< defn.PartialFunctionType
881+
val unchecked = pt.isRef(defn.PartialFunctionClass)
882882
typed(desugar.makeCaseLambda(tree.cases, protoFormals.length, unchecked) withPos tree.pos, pt)
883883
case _ =>
884884
val sel1 = typedExpr(tree.selector)

tests/patmat/i3206.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
val foo: PartialFunction[Option[Int], Int] = {
3+
case Some(x) => x
4+
}
5+
}

tests/patmat/partial-function.check

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)