diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 66168724b0..51b53dff76 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1134,11 +1134,12 @@ trait Parsers { case DOT => simpleExprRest(atPos(inSkipToken) { selector(stripParens(t)) }, true) case LBRACKET => - t match { + val t1 = stripParens(t) + t1 match { case Ident(_) | Select(_, _) => - simpleExprRest(atPos(inCurrentPos) { TypeApply(t, typeArgs(false)) }, true) + simpleExprRest(atPos(inCurrentPos) { TypeApply(t1, typeArgs(false)) }, true) case _ => - t + t1 } case LPAREN | LBRACE if (canApply) => simpleExprRest(atPos(inCurrentPos) { Apply(stripParens(t), argumentExprs()) }, true) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7b6d84acb8..3e87dbcc7d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -605,6 +605,13 @@ trait Typers requires Analyzer { setError(tree) } case _ => + def applyPossible = { + def applyMeth = member(adaptToName(tree, nme.apply), nme.apply) + if ((mode & TAPPmode) != 0) + tree.tpe.typeParams.isEmpty && applyMeth.filter(! _.tpe.typeParams.isEmpty) != NoSymbol + else + applyMeth.filter(_.tpe.paramSectionCount > 0) != NoSymbol + } if (tree.isType) { if ((mode & FUNmode) != 0) { tree @@ -655,9 +662,7 @@ trait Typers requires Analyzer { } else if ((mode & (EXPRmode | FUNmode)) == (EXPRmode | FUNmode) && !tree.tpe.isInstanceOf[MethodType] && !tree.tpe.isInstanceOf[OverloadedType] && - ((mode & TAPPmode) == 0 || tree.tpe.typeParams.isEmpty) && - member(adaptToName(tree, nme.apply), nme.apply) - .filter(m => m.tpe.paramSectionCount > 0) != NoSymbol) { // (8) + applyPossible) { assert((mode & HKmode) == 0) //@M val qual = adaptToName(tree, nme.apply) match { case id @ Ident(_) => |