aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorliu fengyun <liu@fengy.me>2017-04-13 15:03:13 +0200
committerGitHub <noreply@github.com>2017-04-13 15:03:13 +0200
commitfb4adc3c9c55476d2fe0deed22cff54e8e945406 (patch)
treeb7577f66688ed793a73ff543042a140e62cbe80d /compiler/src/dotty/tools/dotc/typer/Applications.scala
parentcf37737f56db7bc2f7429f78328dc5eea1716356 (diff)
parentde6461ab17562dbb46a1ff094590e051d03cb54c (diff)
downloaddotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.tar.gz
dotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.tar.bz2
dotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.zip
Merge branch 'master' into fix-2253
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index c4d3e2292..7e17abbcd 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -48,9 +48,6 @@ object Applications {
ref.info.widenExpr.dealias
}
- def canProductMatch(tp: Type)(implicit ctx: Context) =
- extractorMemberType(tp, nme._1).exists
-
/** Does `tp` fit the "product match" conditions as an unapply result type
* for a pattern with `numArgs` subpatterns?
* This is the case of `tp` has members `_1` to `_N` where `N == numArgs`.
@@ -72,7 +69,7 @@ object Applications {
}
def productArity(tp: Type)(implicit ctx: Context) =
- if (canProductMatch(tp)) productSelectorTypes(tp).size else -1
+ if (defn.isProductSubType(tp)) productSelectorTypes(tp).size else -1
def productSelectors(tp: Type)(implicit ctx: Context): List[Symbol] = {
val sels = for (n <- Iterator.from(0)) yield tp.member(nme.selectorName(n)).symbol
@@ -114,7 +111,7 @@ object Applications {
getUnapplySelectors(getTp, args, pos)
else if (unapplyResult isRef defn.BooleanClass)
Nil
- else if (canProductMatch(unapplyResult))
+ else if (defn.isProductSubType(unapplyResult))
productSelectorTypes(unapplyResult)
// this will cause a "wrong number of arguments in pattern" error later on,
// which is better than the message in `fail`.