diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t7860.check | 9 | ||||
-rw-r--r-- | test/files/neg/t7860.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t7860.scala | 42 | ||||
-rw-r--r-- | test/files/neg/warn-unused-privates.check | 5 | ||||
-rw-r--r-- | test/files/neg/warn-unused-privates.scala | 8 |
5 files changed, 64 insertions, 1 deletions
diff --git a/test/files/neg/t7860.check b/test/files/neg/t7860.check new file mode 100644 index 0000000000..9b9d86c89d --- /dev/null +++ b/test/files/neg/t7860.check @@ -0,0 +1,9 @@ +t7860.scala:5: warning: private class for your eyes only in object Test is never used + private implicit class `for your eyes only`(i: Int) { // warn + ^ +t7860.scala:31: warning: private class C in object Test3 is never used + private implicit class C(val i: Int) extends AnyVal { // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t7860.flags b/test/files/neg/t7860.flags new file mode 100644 index 0000000000..6ff0dea0b2 --- /dev/null +++ b/test/files/neg/t7860.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Ywarn-unused:privates diff --git a/test/files/neg/t7860.scala b/test/files/neg/t7860.scala new file mode 100644 index 0000000000..6cc0d3e7f5 --- /dev/null +++ b/test/files/neg/t7860.scala @@ -0,0 +1,42 @@ + +class Test + +object Test { + private implicit class `for your eyes only`(i: Int) { // warn + def f = i + } +} + +class Test2 { + import Test2._ + println(5.toStr) +} + +object Test2 { + // was: warning: private object in object Test2 is never used + // i.e. synthetic object C + private implicit class C(val i: Int) extends AnyVal { // no warn + def toStr = i.toString + } +} + +class Test3 { + import Test3._ + //println(5.toStr) +} + +object Test3 { + // was: warning: private object in object Test2 is never used + // i.e. synthetic object C + private implicit class C(val i: Int) extends AnyVal { // warn + def toStr = i.toString + } +} + +object Test4 { + class A { class B } + + private val a: A = new A + + def b = (new a.B).## +} diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check index 490e070794..d4853847fd 100644 --- a/test/files/neg/warn-unused-privates.check +++ b/test/files/neg/warn-unused-privates.check @@ -97,6 +97,9 @@ warn-unused-privates.scala:118: warning: local class DingDongDoobie is never use warn-unused-privates.scala:121: warning: local type OtherThing is never used type OtherThing = String // warn ^ +warn-unused-privates.scala:216: warning: private class for your eyes only in object not even using companion privates is never used + private implicit class `for your eyes only`(i: Int) { // warn + ^ warn-unused-privates.scala:201: warning: pattern var z in method f is never used; `z@_' suppresses this warning case z => "warn" ^ @@ -104,5 +107,5 @@ warn-unused-privates.scala:208: warning: pattern var z in method f is never used case Some(z) => "warn" ^ error: No warnings can be incurred under -Xfatal-warnings. -35 warnings found +36 warnings found one error found diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index 777e0f1579..6f16ab4138 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -209,3 +209,11 @@ trait CaseyAtTheBat { case None => "no warn" } } + +class `not even using companion privates` + +object `not even using companion privates` { + private implicit class `for your eyes only`(i: Int) { // warn + def f = i + } +} |