diff options
author | Paul Phillips <paulp@improving.org> | 2012-11-04 06:08:30 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-11-04 06:08:30 -0800 |
commit | 98ccb9fea2ef3b4ce2a519ccc55ad61be84a0508 (patch) | |
tree | 37bc58788271e4ee5d5b896abc7ef840d3ef116f /test/files/neg | |
parent | b5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb (diff) | |
parent | 477eee3acf0ec9e6f339efb97a213a2a0775495f (diff) | |
download | scala-98ccb9fea2ef3b4ce2a519ccc55ad61be84a0508.tar.gz scala-98ccb9fea2ef3b4ce2a519ccc55ad61be84a0508.tar.bz2 scala-98ccb9fea2ef3b4ce2a519ccc55ad61be84a0508.zip |
Merge pull request #1564 from paulp/issue/441
Expanded unused warnings.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/warn-unused-privates.check | 49 | ||||
-rw-r--r-- | test/files/neg/warn-unused-privates.scala | 53 |
2 files changed, 91 insertions, 11 deletions
diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check index c37e01106c..9c41a33e8f 100644 --- a/test/files/neg/warn-unused-privates.check +++ b/test/files/neg/warn-unused-privates.check @@ -4,27 +4,60 @@ warn-unused-privates.scala:2: warning: private constructor in class Bippy is nev warn-unused-privates.scala:4: warning: private method in class Bippy is never used private def boop(x: Int) = x+a+b // warn ^ -warn-unused-privates.scala:6: warning: private getter in class Bippy is never used +warn-unused-privates.scala:6: warning: private val in class Bippy is never used final private val MILLIS2: Int = 1000 // warn ^ -warn-unused-privates.scala:13: warning: private getter in object 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:41: warning: private getter in trait Accessors is never used +warn-unused-privates.scala:35: 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 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 v2: Int = 0 // warn, never set ^ -warn-unused-privates.scala:43: warning: private getter in trait Accessors is never used +warn-unused-privates.scala:44: warning: private var in trait Accessors is never used private var v3: Int = 0 // warn, never got ^ -warn-unused-privates.scala:55: warning: private default argument in trait DefaultArgs is never used +warn-unused-privates.scala:56: 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:55: warning: private default argument in trait DefaultArgs is never used +warn-unused-privates.scala:56: 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 + var x = 1 // warn + ^ +warn-unused-privates.scala:74: 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 + private object Dongo { def f = this } // warn + ^ +warn-unused-privates.scala:94: 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 + var x = 100 // warn about it being a var + ^ +warn-unused-privates.scala:85: 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 + private type Alias1 = String // warn + ^ +warn-unused-privates.scala:95: warning: local class Hi is never used + class Hi { // warn + ^ +warn-unused-privates.scala:99: warning: local class DingDongDoobie is never used + class DingDongDoobie // warn + ^ +warn-unused-privates.scala:102: warning: local type OtherThing is never used + type OtherThing = String // warn + ^ error: No warnings can be incurred under -Xfatal-warnings. -9 warnings found +20 warnings found one error found diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index 1ac272357f..cb6e946a34 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -18,8 +18,10 @@ class B1(msg: String) extends A(msg) class B2(msg0: String) extends A(msg0) class B3(msg0: String) extends A("msg") -/*** Early defs full of noise due to SI-6595. ***/ -/*** +/*** Early defs warnings disabled primarily due to SI-6595. + * The test case is here to assure we aren't issuing false positives; + * the ones labeled "warn" don't warn. + ***/ class Boppy extends { private val hmm: String = "abc" // no warn, used in early defs private val hom: String = "def" // no warn, used in body @@ -35,7 +37,6 @@ class Boppy extends { private final val bum = "ghi" // no warn, might have been (was) inlined final val bum2 = "ghi" // no warn, same } -***/ trait Accessors { private var v1: Int = 0 // warn @@ -56,3 +57,49 @@ trait DefaultArgs { def boppy() = bippy(5, 100, 200) } + +class Outer { + class Inner +} + +trait Locals { + def f0 = { + var x = 1 // warn + var y = 2 + y = 3 + y + y + } + def f1 = { + val a = new Outer // no warn + val b = new Outer // warn + new a.Inner + } + def f2 = { + var x = 100 // warn about it being a var + x + } +} + +object Types { + private object Dongo { def f = this } // warn + private class Bar1 // warn + private class Bar2 // no warn + private type Alias1 = String // warn + private type Alias2 = String // no warn + def bippo = (new Bar2).toString + + def f(x: Alias2) = x.length + + def l1() = { + object HiObject { def f = this } // warn + class Hi { // warn + def f1: Hi = new Hi + def f2(x: Hi) = x + } + class DingDongDoobie // warn + class Bippy // no warn + type Something = Bippy // no warn + type OtherThing = String // warn + (new Bippy): Something + } +} |