@@ -48,9 +48,6 @@ object Applications {
48
48
ref.info.widenExpr.dealias
49
49
}
50
50
51
- def canProductMatch (tp : Type )(implicit ctx : Context ) =
52
- extractorMemberType(tp, nme._1).exists
53
-
54
51
/** Does `tp` fit the "product match" conditions as an unapply result type
55
52
* for a pattern with `numArgs` subpatterns?
56
53
* This is the case of `tp` has members `_1` to `_N` where `N == numArgs`.
@@ -72,7 +69,7 @@ object Applications {
72
69
}
73
70
74
71
def productArity (tp : Type )(implicit ctx : Context ) =
75
- if (canProductMatch (tp)) productSelectorTypes(tp).size else - 1
72
+ if (defn.isProductSubType (tp)) productSelectorTypes(tp).size else - 1
76
73
77
74
def productSelectors (tp : Type )(implicit ctx : Context ): List [Symbol ] = {
78
75
val sels = for (n <- Iterator .from(0 )) yield tp.member(nme.selectorName(n)).symbol
@@ -114,7 +111,7 @@ object Applications {
114
111
getUnapplySelectors(getTp, args, pos)
115
112
else if (unapplyResult isRef defn.BooleanClass )
116
113
Nil
117
- else if (canProductMatch (unapplyResult))
114
+ else if (defn.isProductSubType (unapplyResult))
118
115
productSelectorTypes(unapplyResult)
119
116
// this will cause a "wrong number of arguments in pattern" error later on,
120
117
// which is better than the message in `fail`.
0 commit comments