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)]
爲什麼我有這樣的類似問題?如何解決它?