Closed
Description
This subtle example minimized from ScalaTest code base requires two files and a particular compilation order:
1.scala:
final class PosZInt private (val value: Int) extends AnyVal
object PosZInt {
def from(value: Int): Option[PosZInt] =
if (value >= 0) Some(new PosZInt(value)) else None
}
2.scala:
object Test {
scala.util.Try(PosZInt.from(1).get)
}
run 2.scala 1.scala
Leads to:
assertion failed: private constructor PosZInt in class PosZInt in 1.scala accessed from method $anonfun in object Test in 2.scala
I'm guessing the generated code is correct, so maybe it should be enough to remove / relax the assertion?
Metadata
Metadata
Assignees
Labels
No labels