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

[E029] Pattern Match Exhaustivity Warning: ... ReceiveResult.MsgFromServer(_) #1

Open
ryanberckmans opened this issue Sep 13, 2019 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@ryanberckmans
Copy link
Owner

[warn] -- [E029] Pattern Match Exhaustivity Warning: noric-bot/src/main/scala/Bot.scala:21:35
[warn] 21 |    if (isConnected) socket.receive() match {
[warn]    |                     ^^^^^^^^^^^^^^^^
[warn]    |           match may not be exhaustive.
[warn]    |
[warn]    |           It would fail on pattern case: ReceiveResult.MsgFromServer(_)
[warn] -- Warning: noric-bot/src/main/scala/Bot.scala:23:11
[warn] 23 |      case m:MsgFromServer => {
[warn]    |           ^^^^^^^^^^^^^^^
[warn]    |        the type test for Bot.MsgFromServer cannot be checked at runtime
[warn] two warnings found

We can see that the type Bot.MsgFromServer is defined as export ClientSocket.MsgFromServer which itself is defined as export ReceiveResult._.

The intention is for the type Bot.MsgFromServer to be equal to ClientSocket.ReceiveResult.MsgFromServer without exposing the other values of the enum ReceiveResult.

I believe this warning is due to an interaction between export and pattern matching. There has been no runtime consequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant