summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-19 14:28:35 -0700
committerPaul Phillips <paulp@improving.org>2013-04-19 14:28:35 -0700
commit13788e97184c4f48a4378ec2e8717efa8b31874a (patch)
treed94db377fc2f7168f9c328de77a7df816435de67 /src
parent2ecd09fe1d79371ea5bcc529066d7bda0146cca3 (diff)
parent15e9ef8f083e0c0dc75bf51a0784f56df2e2bea8 (diff)
downloadscala-13788e97184c4f48a4378ec2e8717efa8b31874a.tar.gz
scala-13788e97184c4f48a4378ec2e8717efa8b31874a.tar.bz2
scala-13788e97184c4f48a4378ec2e8717efa8b31874a.zip
Merge pull request #2402 from retronym/ticket/7377
SI-7377 Fix retypechecking of patterns on case companion alias
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index d3e9192066..8cfb975a54 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4526,8 +4526,13 @@ trait Typers extends Modes with Adaptations with Tags {
def normalTypedApply(tree: Tree, fun: Tree, args: List[Tree]) = {
val stableApplication = (fun.symbol ne null) && fun.symbol.isMethod && fun.symbol.isStable
- if (stableApplication && isPatternMode) {
+ if (args.isEmpty && stableApplication && isPatternMode) {
// treat stable function applications f() as expressions.
+ //
+ // [JZ] According to Martin, this is related to the old pattern matcher, which
+ // needs to typecheck after a the translation of `x.f` to `x.f()` in a prior
+ // compilation phase. As part of SI-7377, this has been tightened with `args.isEmpty`,
+ // but we should remove it altogether in Scala 2.11.
typed1(tree, mode & ~PATTERNmode | EXPRmode, pt)
} else {
val funpt = if (isPatternMode) pt else WildcardType