Skip to content

Commit f90b7ef

Browse files
committed
fix false positive warning
1 parent 4ef884b commit f90b7ef

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ object SpaceEngine {
362362
val funRef = fun1.tpe.asInstanceOf[TermRef]
363363
if (fun.symbol.name == nme.unapplySeq)
364364
val (arity, elemTp, resultTp) = unapplySeqInfo(fun.tpe.widen.finalResultType, fun.srcPos)
365-
if fun.symbol.owner == defn.SeqFactoryClass && pat.tpe.hasClassSymbol(defn.ListClass) then
365+
if fun.symbol.owner == defn.SeqFactoryClass && toUnderlying(pat.tpe).dealias.derivesFrom(defn.ListClass) then
366366
// The exhaustivity and reachability logic already handles decomposing sum types (into its subclasses)
367367
// and product types (into its components). To get better counter-examples for patterns that are of type
368368
// List (or a super-type of list, like LinearSeq) we project them into spaces that use `::` and Nil.

tests/pos/i23928.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
Nil match {
3+
case Seq(xs*) => 42
4+
}
5+
}

0 commit comments

Comments
 (0)