0
sealed trait Option_40to49[+A] {
def map[B](f: A => B): Option[B] = this match {
case None => None
case Some(x) => Some(f(x))
}
}
我在日食工作的匹配,它强调无下一个错误:阶格局特征
pattern type is incompatible with expected type; found : None.type required: packageName.Option_40to49[A]
,并与一些(X)
constructor cannot be instantiated to expected type; found : Some[A(in class Some)] required: packageName.Option_40to49[A(in trait Option_40to49)]
为什么我有这样的类似问题?如何解决它?