git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@8031 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
b33be08fb2
commit
84bc1b7e66
|
@ -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) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue