Skip to content

Commit 49af9cf

Browse files
committed
Fix typo leading to incorrect unreachable case warning
1 parent 4d44638 commit 49af9cf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ trait SpaceLogic {
187187
case (Typ(tp1, _), Prod(tp2, fun, ss)) =>
188188
isSubType(tp1, tp2)
189189
&& covers(fun, tp1, ss.length)
190-
&& isSubspace(Prod(tp2, fun, signature(fun, tp2, ss.length).map(Typ(_, false))), b)
190+
&& isSubspace(Prod(tp2, fun, signature(fun, tp1, ss.length).map(Typ(_, false))), b)
191191
case (Prod(_, fun1, ss1), Prod(_, fun2, ss2)) =>
192192
isSameUnapply(fun1, fun2) && ss1.zip(ss2).forall((isSubspace _).tupled)
193193
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
case class Foo[T](x: T)
2+
class Bar extends Foo[String]("")
3+
4+
def test(x: Any) = x match
5+
case Foo(1) =>
6+
case _: Bar => // used to warn about unreachable case
7+
// case _: Foo[_] => // still warns, something else is wrong

0 commit comments

Comments
 (0)