Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No "unreachable code" warning when using partial function syntax #18493

Closed
sake92 opened this issue Aug 31, 2023 · 2 comments · Fixed by #18497
Closed

No "unreachable code" warning when using partial function syntax #18493

sake92 opened this issue Aug 31, 2023 · 2 comments · Fixed by #18497
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@sake92
Copy link

sake92 commented Aug 31, 2023

Compiler version

3.*

Minimized code

object PartialFunctionNoWarning {

  // nice warning
  "abc" match {
    case "abc" =>
    case "abc" =>
  }
  
  // no warnings
  val pf: PartialFunction[String, Unit] = {
    case "abc" =>
    case "abc" =>
  }

}

Output

"unreachable code" when using match.

Expectation

"unreachable code" shows when using partial function syntax too.
In scala 2 it does show a warning.

@sake92 sake92 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 31, 2023
@jchyb jchyb added area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 1, 2023
@bishabosha bishabosha added Spree Suitable for a future Spree area:reporting Error reporting including formatting, implicit suggestions, etc area:pattern-matching and removed area:reporting Error reporting including formatting, implicit suggestions, etc labels Sep 1, 2023
@jchyb jchyb removed area:pattern-matching Spree Suitable for a future Spree labels Sep 1, 2023
@jchyb
Copy link
Contributor

jchyb commented Sep 1, 2023

Good news! This appears to be fixed in 3.3.1-RC7 (so will be in 3.3.1) and on main.

@jchyb
Copy link
Contributor

jchyb commented Sep 1, 2023

Sorry @bishabosha, I think I filled in the labels at the same time as you, causing the mess above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants