summaryrefslogtreecommitdiff
path: root/src/scalap
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-04-28 16:26:05 +0000
committerPaul Phillips <paulp@improving.org>2011-04-28 16:26:05 +0000
commitc5d9b7e6a99f253d6da941610c58d9d9e1a02925 (patch)
tree461c02007998ff775201b6860843b555f4ae3bfc /src/scalap
parent199ec3c10fe7d2b2029ea8ae6a19240b46181435 (diff)
downloadscala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.gz
scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.bz2
scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.zip
I wrote a warning when nullary methods return U...
I wrote a warning when nullary methods return Unit. I wimped out of including it in this patch because we had about 200 of them, and that's what is fixed in this patch. I will add the warning to some kind of "-Xlint" feature after 2.9. This is motivated at least partly by the resolution of #4506, which indicates the distinction between "def foo()" and "def foo" will continue to jab its pointy stick into our eyes, so I believe we have a minimal duty of at least following our own advice about what they mean and not making a semirandom choice as to whether a method has parens or not. Review by community.
Diffstat (limited to 'src/scalap')
-rw-r--r--src/scalap/scala/tools/scalap/CodeWriter.scala2
-rw-r--r--src/scalap/scala/tools/scalap/JavaWriter.scala4
-rw-r--r--src/scalap/scala/tools/scalap/MetaParser.scala2
-rw-r--r--src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/scalap/scala/tools/scalap/CodeWriter.scala b/src/scalap/scala/tools/scalap/CodeWriter.scala
index db9b3d570b..d895ce3836 100644
--- a/src/scalap/scala/tools/scalap/CodeWriter.scala
+++ b/src/scalap/scala/tools/scalap/CodeWriter.scala
@@ -73,7 +73,7 @@ class CodeWriter(writer: Writer) {
this
}
- def * : Unit = {}
+ def *() = {}
def println: CodeWriter = newline
diff --git a/src/scalap/scala/tools/scalap/JavaWriter.scala b/src/scalap/scala/tools/scalap/JavaWriter.scala
index 9dd867a1b4..db9d6c5ed9 100644
--- a/src/scalap/scala/tools/scalap/JavaWriter.scala
+++ b/src/scalap/scala/tools/scalap/JavaWriter.scala
@@ -172,7 +172,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
}
}
- def printClassHeader {
+ def printClassHeader() {
if (isInterface(cf.flags)) {
print("trait " + getSimpleClassName(cf.classname))
} else {
@@ -185,7 +185,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
}
}
- def printClass {
+ def printClass() {
val pck = getPackage(cf.classname);
if (pck.length() > 0)
println("package " + pck + ";")
diff --git a/src/scalap/scala/tools/scalap/MetaParser.scala b/src/scalap/scala/tools/scalap/MetaParser.scala
index ac76a94b9c..ca9bd93f86 100644
--- a/src/scalap/scala/tools/scalap/MetaParser.scala
+++ b/src/scalap/scala/tools/scalap/MetaParser.scala
@@ -27,7 +27,7 @@ class MetaParser(meta: String) {
token
}
- protected def parseType: Unit = {
+ protected def parseType(): Unit = {
if (token startsWith "?")
res.append(token.substring(1))
else
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
index 93c1c7a394..df78bad25e 100644
--- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
+++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
@@ -239,7 +239,7 @@ class ScalaSigPrinter(stream: PrintStream, printPrivates: Boolean) {
}
def printMethod(level: Int, m: MethodSymbol, indent: () => Unit) {
- def cont = print(" = { /* compiled code */ }")
+ def cont() = print(" = { /* compiled code */ }")
val n = m.name
if (underCaseClass(m) && n == CONSTRUCTOR_NAME) return