- Notifications
You must be signed in to change notification settings - Fork131
Open
Description
In scala 2.13.5, the match expression will raise inexhaustive warning for following code
// warning: match may not be exhaustive. It would fail on the following inputs: Error(_, _), Failure(_, _)parse(freq,"johnny 121")match {caseSuccess(matched,_)=> println(matched)caseNoSuccess(msg,_)=> println(s"NoSuccess:$msg") }
It looks like it's a problem here
scala-parser-combinators/shared/src/main/scala/scala/util/parsing/combinator/Parsers.scala
Lines 181 to 187 in0cb7184
objectNoSuccess { | |
defunapply[T](x:ParseResult[T])= xmatch { | |
caseFailure(msg, next)=>Some((msg, next)) | |
caseError(msg, next)=>Some((msg, next)) | |
case _=>None | |
} | |
} |
An alternative fix is change it to
objectNoSuccess {defunapply(x:NoSuccess)= xmatch {caseFailure(msg, next)=>Some((msg, next))caseError(msg, next)=>Some((msg, next)) } }
And then may also need to revert commitc1fbc3c
But it will fail binary compatibility check.
see also:scala/bug#12384
Metadata
Metadata
Assignees
Labels
No labels