Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive unused:privates for private object #11681

Open
NthPortal opened this issue Aug 13, 2019 · 0 comments

Comments

@NthPortal
Copy link

commented Aug 13, 2019

Warning for unused:privates yields a false positive when a method of one private object is accessed from an object in the same package but a different file (despite the code compiling and accessing the method fine). For example,

contents of Test.scala:

package com.example

private object Test {
  def foo: String = "foo"
}

contents of Main.scala:

package com.example

object Main {
  def test: String = Test.foo
}

result of scalac -Ywarn-unused:privates Test.scala Main.scala (for both 2.13.0 and 2.12.9):

Test.scala:3: warning: private object Test in package example is never used
private object Test {
               ^
one warning found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.