diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-30 23:02:44 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-31 07:01:12 -0800 |
commit | 008a781f49feb567833e9347ff9d293defeafe6d (patch) | |
tree | 26efcae8f28c0af70c236840e87de796ebe4b838 | |
parent | 82c793a438c7bd802daf96c8b2012f54fbd737ba (diff) | |
download | scala-008a781f49feb567833e9347ff9d293defeafe6d.tar.gz scala-008a781f49feb567833e9347ff9d293defeafe6d.tar.bz2 scala-008a781f49feb567833e9347ff9d293defeafe6d.zip |
More uniformity for the parser.
Fixing consecutive type application made it more obvious there was
another missing bit of the parser, type application following function
application. This should (and now does) work:
object F { def apply[T] = List[T]() }
def g() = F
g()[String]
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 8 | ||||
-rw-r--r-- | test/files/run/type-currying.scala | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 00ac3976a9..db97dd3475 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1533,12 +1533,12 @@ self => case LBRACKET => val t1 = stripParens(t) t1 match { - case Ident(_) | Select(_, _) => - var tapp: Tree = t1 + case Ident(_) | Select(_, _) | Apply(_, _) => + var app: Tree = t1 while (in.token == LBRACKET) - tapp = atPos(tapp.pos.startOrPoint, in.offset)(TypeApply(tapp, exprTypeArgs())) + app = atPos(app.pos.startOrPoint, in.offset)(TypeApply(app, exprTypeArgs())) - simpleExprRest(tapp, true) + simpleExprRest(app, true) case _ => t1 } diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index 717e0763a3..f9764c64f0 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -43,3 +43,16 @@ object Test { assert(n0 == n1) } } + +class A { + object Foo { + def apply[T] = Bar + } + object Bar { + def apply() = Foo + } + + def f() = Foo + def g = f()[Int]()[String]() + def h = Foo[Foo.type]()[Foo.type]() +} |