尝试修复客户端 API 但在此处遇到问题:
case Some(List(Some(msgType:String), Some(channel:String), Some(data:String))) =>
List(Some(msgType:String), Some(channel:String), Some(data:String)).foreach {
msgType match {
case "message" | "pmessage" =>
fn(M(channel, data))
case x => throw new RuntimeException("unhandled message: " + x)
}
}
当我去编译代码时,我得到了type mismatch; found : Any required: Some[String] => ?
错误fn(M(channel, data))
如何正确构建匹配以使其接收类型?