diff options
-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]() +} |