summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-06 14:09:06 -0800
committerPaul Phillips <paulp@improving.org>2013-01-06 14:09:06 -0800
commit1fed72948829b3411e8b89f70063b3771d77348e (patch)
treee9fb4d73a3edd563367f82bff747d635ac493483 /src
parent8685257f389ae5e8301bdbd590e5b0b218b6d8a8 (diff)
parenta6ce037f9647615192e4dc1dd3162c0fe0a4d132 (diff)
downloadscala-1fed72948829b3411e8b89f70063b3771d77348e.tar.gz
scala-1fed72948829b3411e8b89f70063b3771d77348e.tar.bz2
scala-1fed72948829b3411e8b89f70063b3771d77348e.zip
Merge pull request #1835 from paulp/issue/6896
SI-6896, spurious warning with overloaded main.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala
index 49c0fa2757..540935fd57 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala
@@ -78,17 +78,19 @@ trait GenJVMASM {
failNoForwarder("companion is a trait")
// Now either succeeed, or issue some additional warnings for things which look like
// attempts to be java main methods.
- else possibles exists { m =>
- m.info match {
- case PolyType(_, _) =>
- fail("main methods cannot be generic.")
- case MethodType(params, res) =>
- if (res.typeSymbol :: params exists (_.isAbstractType))
- fail("main methods cannot refer to type parameters or abstract types.", m.pos)
- else
- isJavaMainMethod(m) || fail("main method must have exact signature (Array[String])Unit", m.pos)
- case tp =>
- fail("don't know what this is: " + tp, m.pos)
+ else (possibles exists isJavaMainMethod) || {
+ possibles exists { m =>
+ m.info match {
+ case PolyType(_, _) =>
+ fail("main methods cannot be generic.")
+ case MethodType(params, res) =>
+ if (res.typeSymbol :: params exists (_.isAbstractType))
+ fail("main methods cannot refer to type parameters or abstract types.", m.pos)
+ else
+ isJavaMainMethod(m) || fail("main method must have exact signature (Array[String])Unit", m.pos)
+ case tp =>
+ fail("don't know what this is: " + tp, m.pos)
+ }
}
}
}