Skip to content

Commit 248b9f1

Browse files
committed
Check for error type before checking members of product in getUnapplySelectors
1 parent 09d64c6 commit 248b9f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ object Applications {
218218
val isProduct = args match
219219
case x :: xs => x.isInstanceOf[untpd.NamedArg] || xs.nonEmpty
220220
case _ => false
221-
if isProduct && !tp.derivesFrom(defn.SeqClass) then
221+
if isProduct && !tp.derivesFrom(defn.SeqClass) && !tp.isError then
222222
productUnapplySelectors(tp).getOrElse:
223223
// There are unapplys with return types which have `get` and `_1, ..., _n`
224224
// as members, but which are not subtypes of Product. So `productUnapplySelectors`

tests/pos/i23156.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Unpack {
2+
(1, 2) match {
3+
case Unpack(first, _) => first
4+
}
5+
def unapply(e: (Int, Int)): Option[T] = ???
6+
}

0 commit comments

Comments
 (0)