You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- [E030] MatchcaseUnreachableWarning: tl-count.scala:7:14------------------7| assert(count(true) ==1)
| ^^^^^^^^^^^
|Unreachablecase|-----------------------------------------------------------------------------|Inline stack trace
|---------------------------------------|This location contains code that was inlined from tl-count.scala:55|casefalse=>0| ^^^^^
------------------------------------------------------------------------------- [E030] MatchcaseUnreachableWarning: tl-count.scala:8:14------------------8| assert(count(false) ==0)
| ^^^^^^^^^^^^
|Unreachablecase|-----------------------------------------------------------------------------|Inline stack trace
|---------------------------------------|This location contains code that was inlined from tl-count.scala:44|casetrue=>1| ^^^^
-----------------------------------------------------------------------------
Expectation
No warnings. Generally, unreachable case warnings should be disabled for code that was inlined.
I encountered this in the wild where it did not find the source line correctly and was completely stumped until I changed the error message to give me a little bit more info. After the change I got this, which was more intelligible. I think that would be a good idea independently, but ideally we also mention previous cases as proposed in #18519.
7| assert(count(true) ==1)
| ^^^^^^^^^^^
|Unreachablecase:|Patternfalse| cannot possibly match a selector of type (true:Boolean)
| at this point in the match sequence.
|-----------------------------------------------------------------------------|Inline stack trace
|---------------------------------------|This location contains code that was inlined from tl-count.scala:55|casefalse=>0| ^^^^^
------------------------------------------------------------------------------- [E030] MatchcaseUnreachableWarning: tl-count.scala:8:14------------------8| assert(count(false) ==0)
| ^^^^^^^^^^^^
|Unreachablecase:|Patterntrue| cannot possibly match a selector of type (false:Boolean)
| at this point in the match sequence.
|-----------------------------------------------------------------------------|Inline stack trace
|---------------------------------------|This location contains code that was inlined from tl-count.scala:44|casetrue=>1| ^^^^
-----------------------------------------------------------------------------
Overall, I believe that eliminating false unreachable warnings and improving error messages for real ones should be a priority for us. It's a major source of unfriendliness and head-scratching. And the other thing really needing improvement is a more robust reporting of inline traces. I noted when they come from different compilation units they are often wrong.
The text was updated successfully, but these errors were encountered:
And the other thing really needing improvement is a more robust reporting of inline traces. I noted when they come from different compilation units they are often wrong.
I would be good to have a reproduction of that - I've not seen that, but could be I just wasn't looking right.
Compiler version
3.4.0 RC 1
Minimized example
Output
Expectation
No warnings. Generally, unreachable case warnings should be disabled for code that was inlined.
I encountered this in the wild where it did not find the source line correctly and was completely stumped until I changed the error message to give me a little bit more info. After the change I got this, which was more intelligible. I think that would be a good idea independently, but ideally we also mention previous cases as proposed in #18519.
Overall, I believe that eliminating false unreachable warnings and improving error messages for real ones should be a priority for us. It's a major source of unfriendliness and head-scratching. And the other thing really needing improvement is a more robust reporting of inline traces. I noted when they come from different compilation units they are often wrong.
The text was updated successfully, but these errors were encountered: