From bc98d7d5aaeeced69751688b57a69297a528fd3b Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Thu, 14 Nov 2013 17:23:48 +0100 Subject: SI-7961 Fix false positive procedure warnings Two issues are fixed in this commit: - `def foo: Unit` was detected as missing a return type - The warning was emitted for constructors, but `def this(...): Unit = ...` is not valid Scala syntax --- test/files/neg/t7605-deprecation.check | 15 +++++++++------ test/files/neg/t7605-deprecation.scala | 7 +++++-- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/files/neg/t7605-deprecation.check b/test/files/neg/t7605-deprecation.check index 9c466c058c..6db94613a1 100644 --- a/test/files/neg/t7605-deprecation.check +++ b/test/files/neg/t7605-deprecation.check @@ -1,12 +1,15 @@ -t7605-deprecation.scala:2: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit =`. - def this(i: Int) { this() } - ^ -t7605-deprecation.scala:3: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit =`. +t7605-deprecation.scala:2: warning: Procedure syntax is deprecated. Convert procedure `bar` to method by adding `: Unit =`. def bar {} ^ -t7605-deprecation.scala:4: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit`. +t7605-deprecation.scala:3: warning: Procedure syntax is deprecated. Convert procedure `baz` to method by adding `: Unit`. def baz ^ +t7605-deprecation.scala:4: warning: Procedure syntax is deprecated. Convert procedure `boo` to method by adding `: Unit`. + def boo(i: Int, l: Long) + ^ +t7605-deprecation.scala:5: warning: Procedure syntax is deprecated. Convert procedure `boz` to method by adding `: Unit =`. + def boz(i: Int, l: Long) {} + ^ error: No warnings can be incurred under -Xfatal-warnings. -three warnings found +four warnings found one error found diff --git a/test/files/neg/t7605-deprecation.scala b/test/files/neg/t7605-deprecation.scala index 4a7dcd26d6..2b3362f94a 100644 --- a/test/files/neg/t7605-deprecation.scala +++ b/test/files/neg/t7605-deprecation.scala @@ -1,5 +1,8 @@ abstract class Foo { - def this(i: Int) { this() } def bar {} def baz -} \ No newline at end of file + def boo(i: Int, l: Long) + def boz(i: Int, l: Long) {} + def this(i: Int) { this() } // Don't complain here! + def foz: Unit // Don't complain here! +} -- cgit v1.2.3