From c5d9b7e6a99f253d6da941610c58d9d9e1a02925 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 28 Apr 2011 16:26:05 +0000 Subject: 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. --- test/files/neg/accesses.scala | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'test/files/neg/accesses.scala') diff --git a/test/files/neg/accesses.scala b/test/files/neg/accesses.scala index 2a6b45c35b..b1df6c0e6c 100644 --- a/test/files/neg/accesses.scala +++ b/test/files/neg/accesses.scala @@ -1,27 +1,27 @@ package test.p1.p2 abstract class A { - private[p2] def f2: Unit - protected def f3: Unit - private[p1] def f4: Unit - protected[p1] def f5: Unit + private[p2] def f2(): Unit + protected def f3(): Unit + private[p1] def f4(): Unit + protected[p1] def f5(): Unit } abstract class OK1 extends A { - private[p1] def f2: Unit - protected[p2] def f3: Unit - private[test] def f4: Unit - protected[test] def f5: Unit + private[p1] def f2(): Unit + protected[p2] def f3(): Unit + private[test] def f4(): Unit + protected[test] def f5(): Unit } abstract class OK2 extends A { - protected[p1] def f2: Unit - def f3: Unit - protected[p1] def f4: Unit - def f5: Unit + protected[p1] def f2(): Unit + def f3(): Unit + protected[p1] def f4(): Unit + def f5(): Unit } abstract class Err1 extends A { - private def f2: Unit = () - private[p2] def f3: Unit = () - private[p2] def f4: Unit - protected[p2] def f5: Unit + private def f2(): Unit = () + private[p2] def f3(): Unit = () + private[p2] def f4(): Unit + protected[p2] def f5(): Unit } -- cgit v1.2.3