-
Notifications
You must be signed in to change notification settings - Fork 131
Open
@counter2015
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 { case Success(matched,_) => println(matched) case NoSuccess(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 in 0cb7184
object NoSuccess {
def unapply[T](x: ParseResult[T]) = x match {
case Failure(msg, next) => Some((msg, next))
case Error(msg, next) => Some((msg, next))
case _ => None
}
}
An alternative fix is change it to
object NoSuccess { def unapply(x: NoSuccess) = x match { case Failure(msg, next) => Some((msg, next)) case Error(msg, next) => Some((msg, next)) } }
And then may also need to revert commit c1fbc3c
But it will fail binary compatibility check.
see also: scala/bug#12384
Metadata
Metadata
Assignees
Labels
No labels