저는 스칼라에 다소 익숙합니다. 다음은 내 코드입니다. 나는이 문제를 해결하려면 어떻게스칼라 경고 일치가 완전하지 않을 수도 있습니다.
Warning:(35, 11) match may not be exhaustive.
It would fail on the following input: Some(_)
Option(Session.get().getAttribute("player")) match {
^
를 컴파일 할 때
Option(Session.get().getAttribute("player")) match {
case None => {
val player = new Player(user.getEmail, user.getNickname).createOrGet
Session.get().setAttribute("player", player)
}
}
나는 다음과 같은 경고를 얻을? 경고를 피하기 위해 코드를 다시 작성하는 방법이 있습니까? (스칼라 버전 2.10.2를 사용 중입니다.)
고마워요. 당신이 제안한 것을 사용할 것입니다. –
스타일에 대해서는'Session.get.getAttr (옵션) (...) orElse alt' 또는'Some (Session.get) filter (_.getAttr ("foo") foo ")! = null) orElse (s => Some (s.setAttr (" ", x))) 또는 이와 유사합니다. –