summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-02-18 18:01:08 +0000
committerPaul Phillips <paulp@improving.org>2009-02-18 18:01:08 +0000
commit0e04072c89052a6fc296b77df64f6501c36d0c92 (patch)
treed05962e3e43de48ba347f4362c8fae38351607df /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent882022241d42d284e0bb2aa47cf1742107c9c2d3 (diff)
downloadscala-0e04072c89052a6fc296b77df64f6501c36d0c92.tar.gz
scala-0e04072c89052a6fc296b77df64f6501c36d0c92.tar.bz2
scala-0e04072c89052a6fc296b77df64f6501c36d0c92.zip
Fix for #460 (and its duplicate #1413) plus tes...
Fix for #460 (and its duplicate #1413) plus test case. Method f can now be invoked via (f _)(x) without requiring .apply(x).
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 235d4b6df5..f08b08b3d7 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1214,7 +1214,14 @@ trait Parsers extends NewScanners with MarkupParsers {
case LPAREN | LBRACE if (canApply) =>
// again, position should be on idetifier, not (
var pos = if (t.pos == NoPosition) i2p(inCurrentPos) else t.pos
- simpleExprRest(atPos(pos) { Apply(stripParens(t), argumentExprs()) }, true)
+ simpleExprRest(atPos(pos) {
+ // look for anonymous function application like (f _)(x) and translate to (f _).apply(x), bug #460
+ val sel = t match {
+ case Parens(List(Typed(_, _: Function))) => Select(stripParens(t), nme.apply)
+ case _ => stripParens(t)
+ }
+ Apply(sel, argumentExprs())
+ }, true)
case USCORE =>
atPos(inSkipToken) { Typed(stripParens(t), Function(List(), EmptyTree)) }
case _ =>