summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-11-20 17:44:27 -0800
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-11-20 17:44:27 -0800
commit6cc33f09993c688283d5602d077a518f5b49e4d7 (patch)
treea22304c40b9d88167257fa638ab67cc519aa2f0a /src/compiler
parent29293ab56e61cc8bdb97210a04554ed4829b0ff3 (diff)
parent74ca558412b6ef9a8694a6f9d1034b9e09ba4af0 (diff)
downloadscala-6cc33f09993c688283d5602d077a518f5b49e4d7.tar.gz
scala-6cc33f09993c688283d5602d077a518f5b49e4d7.tar.bz2
scala-6cc33f09993c688283d5602d077a518f5b49e4d7.zip
Merge pull request #1620 from namin/si-6551
Fixes SI-6551.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 80785cee2f..f2d7adc628 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1100,6 +1100,10 @@ trait Typers extends Modes with Adaptations with Tags {
instantiateToMethodType(mt)
case _ =>
+ def shouldInsertApply(tree: Tree) = inAllModes(mode, EXPRmode | FUNmode) && (tree.tpe match {
+ case _: MethodType | _: OverloadedType | _: PolyType => false
+ case _ => applyPossible
+ })
def applyPossible = {
def applyMeth = member(adaptToName(tree, nme.apply), nme.apply)
dyna.acceptsApplyDynamic(tree.tpe) || (
@@ -1117,10 +1121,7 @@ trait Typers extends Modes with Adaptations with Tags {
macroExpand(this, tree, mode, pt)
else if ((mode & (PATTERNmode | FUNmode)) == (PATTERNmode | FUNmode))
adaptConstrPattern()
- else if (inAllModes(mode, EXPRmode | FUNmode) &&
- !tree.tpe.isInstanceOf[MethodType] &&
- !tree.tpe.isInstanceOf[OverloadedType] &&
- applyPossible)
+ else if (shouldInsertApply(tree))
insertApply()
else if (!context.undetparams.isEmpty && !inPolyMode(mode)) { // (9)
assert(!inHKMode(mode), modeString(mode)) //@M