diff options
author | Konstantin Fedorov <kfeodorov@MacBook-Pro-Konstantin.local> | 2014-09-08 09:51:41 +0400 |
---|---|---|
committer | Konstantin Fedorov <kfeodorov@MacBook-Pro-Konstantin.local> | 2014-09-10 19:09:34 +0400 |
commit | 24ccfa05bb9af066fe91f182c5f95de837139f0b (patch) | |
tree | 45472ef805288fe939937ba2aca4af8d594c654d /test | |
parent | 2ac6dc03088ecec871838d23aeb688d0e3d4eefb (diff) | |
download | scala-24ccfa05bb9af066fe91f182c5f95de837139f0b.tar.gz scala-24ccfa05bb9af066fe91f182c5f95de837139f0b.tar.bz2 scala-24ccfa05bb9af066fe91f182c5f95de837139f0b.zip |
SI-8398 - unused warning reports lazy val as a method
Compiler internals treat lazy vals as methods. Therefore, we need to have a special case for them when assembling the warning message.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/warn-unused-privates.check | 39 | ||||
-rw-r--r-- | test/files/neg/warn-unused-privates.scala | 1 |
2 files changed, 22 insertions, 18 deletions
diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check index d012869c93..4876ed8fc2 100644 --- a/test/files/neg/warn-unused-privates.check +++ b/test/files/neg/warn-unused-privates.check @@ -10,57 +10,60 @@ warn-unused-privates.scala:6: warning: private val in class Bippy is never used warn-unused-privates.scala:13: warning: private val in object Bippy is never used private val HEY_INSTANCE: Int = 1000 // warn ^ -warn-unused-privates.scala:35: warning: private val in class Boppy is never used +warn-unused-privates.scala:14: warning: private val in object Bippy is never used + private lazy val BOOL: Boolean = true // warn + ^ +warn-unused-privates.scala:36: warning: private val in class Boppy is never used private val hummer = "def" // warn ^ -warn-unused-privates.scala:42: warning: private var in trait Accessors is never used +warn-unused-privates.scala:43: warning: private var in trait Accessors is never used private var v1: Int = 0 // warn ^ -warn-unused-privates.scala:42: warning: private setter in trait Accessors is never used +warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used private var v1: Int = 0 // warn ^ -warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used +warn-unused-privates.scala:44: warning: private setter in trait Accessors is never used private var v2: Int = 0 // warn, never set ^ -warn-unused-privates.scala:44: warning: private var in trait Accessors is never used +warn-unused-privates.scala:45: warning: private var in trait Accessors is never used private var v3: Int = 0 // warn, never got ^ -warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used +warn-unused-privates.scala:57: warning: private default argument in trait DefaultArgs is never used private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 ^ -warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used +warn-unused-privates.scala:57: warning: private default argument in trait DefaultArgs is never used private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 ^ -warn-unused-privates.scala:67: warning: local var in method f0 is never used +warn-unused-privates.scala:68: warning: local var in method f0 is never used var x = 1 // warn ^ -warn-unused-privates.scala:74: warning: local val in method f1 is never used +warn-unused-privates.scala:75: warning: local val in method f1 is never used val b = new Outer // warn ^ -warn-unused-privates.scala:84: warning: private object in object Types is never used +warn-unused-privates.scala:85: warning: private object in object Types is never used private object Dongo { def f = this } // warn ^ -warn-unused-privates.scala:94: warning: local object in method l1 is never used +warn-unused-privates.scala:95: warning: local object in method l1 is never used object HiObject { def f = this } // warn ^ -warn-unused-privates.scala:78: warning: local var x in method f2 is never set - it could be a val +warn-unused-privates.scala:79: warning: local var x in method f2 is never set - it could be a val var x = 100 // warn about it being a var ^ -warn-unused-privates.scala:85: warning: private class Bar1 in object Types is never used +warn-unused-privates.scala:86: warning: private class Bar1 in object Types is never used private class Bar1 // warn ^ -warn-unused-privates.scala:87: warning: private type Alias1 in object Types is never used +warn-unused-privates.scala:88: warning: private type Alias1 in object Types is never used private type Alias1 = String // warn ^ -warn-unused-privates.scala:95: warning: local class Hi is never used +warn-unused-privates.scala:96: warning: local class Hi is never used class Hi { // warn ^ -warn-unused-privates.scala:99: warning: local class DingDongDoobie is never used +warn-unused-privates.scala:100: warning: local class DingDongDoobie is never used class DingDongDoobie // warn ^ -warn-unused-privates.scala:102: warning: local type OtherThing is never used +warn-unused-privates.scala:103: warning: local type OtherThing is never used type OtherThing = String // warn ^ error: No warnings can be incurred under -Xfatal-warnings. -21 warnings found +22 warnings found one error found diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index cb6e946a34..2faa07e759 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -11,6 +11,7 @@ object Bippy { def hi(x: Bippy) = x.HI_COMPANION private val HI_INSTANCE: Int = 500 // no warn, accessed from instance private val HEY_INSTANCE: Int = 1000 // warn + private lazy val BOOL: Boolean = true // warn } class A(val msg: String) |