Given the following minimal code:
package object MyPackage {
case class Pimp(private val i: Int) extends AnyVal
}
SBT (0.13.8) complains:
[warn] sbt-api: Unhandled type class scala.reflect.internal.Types$MethodType : ($this: myPackage.package.Pimp)Int
My build file is roughly this:
Project("sbtissue", file("sbtissue")).settings(scalaVersion := "2.11.6")
Changing the relevant line in the source file to:
class Pimp(private val i: Int) extends AnyVal
or:
case class Pimp(i: Int) extends AnyVal
raises no warning when compiling. What can I do to prevent this warning?
Related: https://groups.google.com/forum/#!topic/simple-build-tool/KWdg4HfYqMk
I think you've found a legitimate edge case, if a little niche maybe.
I would recommend dropping the private
as it doesn't really fit with the idea of a case class, and also, given the existence of a generated unapply, it doesn't hide that value anyways:
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).
Type in expressions to have them evaluated.
Type :help for more information.
scala> case class Pimp(private val i: Int) extends AnyVal
defined class Pimp
scala> val p1 = Pimp(1)
p1: Pimp = Pimp(1)
scala> p1.i
<console>:11: error: value i is not a member of Pimp
p1.i
^
scala> val Pimp(n) = p1
n: Int = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With