Created
February 21, 2015 13:36
-
-
Save taisukeoe/a5e69b9b274def16cc7c to your computer and use it in GitHub Desktop.
パターンマッチの網羅性チェックとifガード節
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> def func(s:Option[String]) = s match{case Some(x) if x.size > 0 => x} | |
func: (s: Option[String])String | |
scala> def func(s:Option[String]) = s match{case Some(x) => x} | |
<console>:7: warning: match may not be exhaustive. | |
It would fail on the following input: None | |
def func(s:Option[String]) = s match{case Some(x) => x} | |
^ | |
func: (s: Option[String])String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment