Closed as not planned
Description
unapply methods used in patterns are allowed implicit arguments. However they're not allowed type parameters, which makes this not all that useful. For example, when helping Jan Kriesten with #882 I tried the following solution:
import scala.reflect.Manifest;
object isClass{
def unapply[T](clazz : Class[_])(implicit man : Manifest[T]) : Option[Unit] =
if (clazz == man.erasure) Some(()) else None
}
classOf[String] match {
case isClass[String] => "foo"
}
Gives the error
<console>:2: error: '=>' expected but '[' found.
case isClass[String] => "foo"
The code works if you specialise T to a String instead, so the implicits are working fine, but the inability to specify a type parameter on the pattern makes this not so useful.