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

Xlint warning "private ... is never used" gives false positive on value class #7860

Closed
scabug opened this issue Sep 19, 2013 · 4 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Sep 19, 2013

It only fails when C is a value class.

scala> :paste
// Entering paste mode (ctrl-D to finish)

class Test {
  import Test._
  println(5.toStr)
}

private object Test {
  private implicit class C(val i: Int) extends AnyVal {
    def toStr = i.toString
  }
}

// Exiting paste mode, now interpreting.

<console>:13: warning: private object in object Test is never used
         private implicit class C(val i: Int) extends AnyVal {
                                ^
defined class Test
defined object Test
@scabug
Copy link
Author

scabug commented Sep 19, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7860?orig=1
Reporter: @sschaef
Affected Versions: 2.11.0

@scabug
Copy link
Author

scabug commented Sep 24, 2014

@som-snytt said:
In 2.11.x, the flag is -Ywarn-unused.

@scabug
Copy link
Author

scabug commented Dec 9, 2016

@som-snytt said (edited on Dec 9, 2016 7:12:06 PM UTC):
scala/scala#5402

Was false positive in the sense of triggering when it should not.

False negative was also tricky.

@som-snytt
Copy link

$ scala -Ywarn-unused
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> :paste
// Entering paste mode (ctrl-D to finish)

class Test {
  import Test._
  println(5.toStr)
}

private object Test {
  private implicit class C(val i: Int) extends AnyVal {
    def toStr = i.toString
  }
}

// Exiting paste mode, now interpreting.

defined class Test
defined object Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants