def getManifest[T : Manifest] = implicitly[Manifest[T]]
class A[T]
object A {
def apply[T] = new A[T]
}
def getA[T : A] = implicitly[A[T]]
val m = getManifest[Int]
//res0: Manifest[Int] = Int
val a = getA[Int]
//<console>:14: error: could not find implicit value for evidence parameter of type A[Int]
Even though there is no implicit variable in context
by calling getManifest[Int]
, m
of type Manifest[Int]
is caputred implicitly
However my custom class A, getA[Int]
emits an error
Because there is no implicit variable in cotext.
What is the difference between class A and Manifest
does Scala compiler knows about Manifest and do some magic ???
like, creating some implicit variables for Manifest