I'm using the Scalacheck library to test my application. In that library there's a Gen
object that defines implicit conversions of any object to a generator of objects of that class.
E.g., importing Gen._
lets you call methods such as sample
on any object, through its implicit conversion to Gen
:
scala> import org.scalacheck.Gen._
import org.scalacheck.Gen._
scala> "foo" sample
res1: Option[java.lang.String] = Some(foo)
In this example, the implicit Gen.value()
is applied to "foo"
, yielding a generator that always returns Some(foo)
.
But this doesn't work:
scala> import org.scalacheck.Gen.value
import org.scalacheck.Gen.value
scala> "foo" sample
<console>:5: error: value sample is not a member of java.lang.String
"foo" sample
^
Why not?
Update
I'm using Scala 2.7.7final and ScalaCheck 2.7.7-1.6.
Update
Just switched to Scala 2.8.0.final with ScalaCheck 2.8.0-1.7. The problem did indeed go away.