Skip to content

improve Unreachable case error message #18519

Open
@He-Pin

Description

@He-Pin

Compiler version

3.3.1

Minimized code

Not minimized yet.

  1. clone incubator-pekko
  2. change the scala3 version to 3.3.1
  3. compile the multi-node-testkit with scala 3.3.1

Output

[error] -- [E030] Match case Unreachable Error: C:\Users\hepin\IdeaProjects\incubator-pekko\multi-node-testkit\src\main\scala\org\apache\pekko\remote\testconductor\Player.scala:218:14
[error] 218 |    case Event(_: ServerOp, _) =>
[error]     |         ^^^^^^^^^^^^^^^^^^^^^
[error]     |         Unreachable case
[error] one error found

Expectation

image
image

I just check the code, the branches will be matched with

    case Event(msg: NetworkOp, _) =>

first , so I think the compiler is right.

Better with an output:

[error] 218 |    case Event(_: ServerOp, _) =>
[error]     |         ^^^^^^^^^^^^^^^^^^^^^
[error]     |         Unreachable case, all case has been matched with `case Event(Done, _) =>` and `case Event(msg: NetworkOp, _)`
[error] one error found

Metadata

Metadata

Assignees

Labels

area:pattern-matchingarea:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions