summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-02 22:26:28 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-02 22:26:28 +1000
commitee916cc789ee89de7ae75bf1b86f960714c8e5e2 (patch)
treeadd6befbd5dcca81b37639fbf8a16759b64c1f99 /src/compiler
parentf1fdfcc6ce03c7a14144fbd354134d55c225c409 (diff)
parent337b52b298be95df0b4b9a4bacb7c4b802620cf6 (diff)
downloadscala-ee916cc789ee89de7ae75bf1b86f960714c8e5e2.tar.gz
scala-ee916cc789ee89de7ae75bf1b86f960714c8e5e2.tar.bz2
scala-ee916cc789ee89de7ae75bf1b86f960714c8e5e2.zip
Merge pull request #4076 from retronym/ticket/8934
SI-8934 Fix whitebox extractor macros in the pres. compiler
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
index 79f5e3bee8..7fcfdf4868 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
@@ -73,9 +73,7 @@ trait ScalacPatternExpanders {
* Unfortunately the MethodType does not carry the information of whether
* it was unapplySeq, so we have to funnel that information in separately.
*/
- def unapplyMethodTypes(method: Type, isSeq: Boolean): Extractor = {
- val whole = firstParamType(method)
- val result = method.finalResultType
+ def unapplyMethodTypes(whole: Type, result: Type, isSeq: Boolean): Extractor = {
val expanded = (
if (result =:= BooleanTpe) Nil
else typeOfMemberNamedGet(result) match {
@@ -126,9 +124,10 @@ trait ScalacPatternExpanders {
val patterns = newPatterns(args)
val isSeq = sel.symbol.name == nme.unapplySeq
val isUnapply = sel.symbol.name == nme.unapply
+
val extractor = sel.symbol.name match {
- case nme.unapply => unapplyMethodTypes(fn.tpe, isSeq = false)
- case nme.unapplySeq => unapplyMethodTypes(fn.tpe, isSeq = true)
+ case nme.unapply => unapplyMethodTypes(firstParamType(fn.tpe), sel.tpe, isSeq = false)
+ case nme.unapplySeq => unapplyMethodTypes(firstParamType(fn.tpe), sel.tpe, isSeq = true)
case _ => applyMethodTypes(fn.tpe)
}