Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Incorrect match inexhaustive warnings ofNoSuccess result. #377

Open
@counter2015

Description

@counter2015

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

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp