diff options
author | Martin Odersky <odersky@gmail.com> | 2007-03-14 14:43:14 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-03-14 14:43:14 +0000 |
commit | 6e53e14f4d2a6f84645b4d22000e034e56e6492c (patch) | |
tree | b33f488a8dfae53e0b776ce84384618a3bcd2276 | |
parent | a1e615c9253d9caad1385e163e271510c3c798b5 (diff) | |
download | scala-6e53e14f4d2a6f84645b4d22000e034e56e6492c.tar.gz scala-6e53e14f4d2a6f84645b4d22000e034e56e6492c.tar.bz2 scala-6e53e14f4d2a6f84645b4d22000e034e56e6492c.zip |
partial fix of bug 999
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 20 | ||||
-rw-r--r-- | test/files/pos/bug1000.scala | 4 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 58fb903aec..7929833e6d 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -384,15 +384,17 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { mainTransform(new TreeSubstituter(vparams map (.symbol), args).transform(body)) } - case UnApply(fn, args) if nme.unapply == fn.symbol.name => - copy.UnApply(tree, fn, transformTrees(args)) - - case UnApply(fn, args) if nme.unapplySeq == fn.symbol.name => - val formals = definitions.unapplyTypeListFromReturnTypeSeq(fn.tpe) - copy.UnApply(tree, fn, transformTrees(transformArgs(tree.pos, args, formals))) - - case UnApply(_, _) => - assert(false,"internal error: UnApply node has wrong symbol"); null + case UnApply(fn, args) => + inPattern = false + val fn1 = transform(fn) + inPattern = true + val args1 = transformTrees( + if (fn.symbol.name == nme.unapply) + args + else if (fn.symbol.name == nme.unapplySeq) + transformArgs(tree.pos, args, definitions.unapplyTypeListFromReturnTypeSeq(fn.tpe)) + else { assert(false,"internal error: UnApply node has wrong symbol"); null }) + copy.UnApply(tree, fn1, args1) case Apply(fn, args) => if (settings.noassertions.value && diff --git a/test/files/pos/bug1000.scala b/test/files/pos/bug1000.scala new file mode 100644 index 0000000000..c6426401ae --- /dev/null +++ b/test/files/pos/bug1000.scala @@ -0,0 +1,4 @@ +object Test extends Application { + val xs = Array(1, 2, 3) + Console.println(xs.filter(_ >= 0).length) +} |