summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 39d9081fef..29e3a8504c 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -285,6 +285,12 @@ abstract class UnCurry extends InfoTransform {
// ------ The tree transformers --------------------------------------------------------
+ def isSequencePattern(tree: Tree) =
+ inPattern &&
+ tree.symbol != null &&
+ !tree.symbol.hasFlag(CASE) &&
+ tree.symbol.isSubClass(SeqClass)
+
def mainTransform(tree: Tree): Tree = {
def withNeedLift(needLift: Boolean)(f: => Tree): Tree = {
@@ -360,7 +366,7 @@ abstract class UnCurry extends InfoTransform {
} else {
withNeedLift(true) {
val formals = fn.tpe.paramTypes;
- if (inPattern && fn.symbol != null && fn.symbol.isSubClass(SeqClass)) {
+ if (isSequencePattern(fn)) {
// normalization to fix bug401
val tpe1 = tree.tpe.baseType(fn.symbol)
tree.setType(tpe1)
@@ -373,6 +379,13 @@ abstract class UnCurry extends InfoTransform {
}
}
+ case Bind(name, body @ Apply(fn, args)) if isSequencePattern(fn) =>
+ val body1 = transform(body)
+ tree.symbol.setInfo(
+ if (treeInfo.isSequenceValued(body1)) seqType(body1.tpe) else body1.tpe)
+ Console.println("retyping "+tree+" to "+tree.symbol.tpe)//debug
+ copy.Bind(tree, name, body1) setType body1.tpe
+
case Assign(Select(_, _), _) =>
withNeedLift(true) { super.transform(tree) }