Skip to content

Commit 4c2f6b3

Browse files
committed
Move error check into productSelectorTypes
1 parent af5d911 commit 4c2f6b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@ object Applications {
131131
else productSelectorTypes(tp, NoSourcePosition)
132132

133133
def productSelectorTypes(tp: Type, errorPos: SrcPos)(using Context): List[Type] = {
134-
val sels = for (n <- Iterator.from(0)) yield extractorMemberType(tp, nme.selectorName(n), errorPos)
135-
sels.takeWhile(_.exists).toList
134+
if tp.isError then
135+
Nil
136+
else
137+
val sels = for (n <- Iterator.from(0)) yield extractorMemberType(tp, nme.selectorName(n), errorPos)
138+
sels.takeWhile(_.exists).toList
136139
}
137140

138141
def tupleComponentTypes(tp: Type)(using Context): List[Type] =
@@ -218,7 +221,7 @@ object Applications {
218221
val isProduct = args match
219222
case x :: xs => x.isInstanceOf[untpd.NamedArg] || xs.nonEmpty
220223
case _ => false
221-
if isProduct && !tp.derivesFrom(defn.SeqClass) && !tp.isError then
224+
if isProduct && !tp.derivesFrom(defn.SeqClass) then
222225
productUnapplySelectors(tp).getOrElse:
223226
// There are unapplys with return types which have `get` and `_1, ..., _n`
224227
// as members, but which are not subtypes of Product. So `productUnapplySelectors`

0 commit comments

Comments
 (0)