Is this a known IDE bug? I’m told the when case is...
# getting-started
m
Is this a known IDE bug? I’m told the when case is not exhaustive, but the missing branch was already handled. If I do add the branch, I get a different error that the branch is unreachable, so there is no way to make the IDE happy.
p
Make it sealed class or you can use class outside of sealed interface & there you can implement
m
Yes there are many ways to workaround it, but it doesn’t change the fact it’s a bug.
😅 1
h
I don't think it's strictly a bug, more like a missing feature: The compiler just isn't smart enough to figure out that the cases not handled in the
if
are enough to make the
when
exhaustive. And TBH, if I saw this code in a review, I would tell you to use either an
if
or a
when
here, but not both…
m
This is a minimal example which makes using both
if
and
when
useless. The real code needs it.
> I don't think it's strictly a bug, more like a missing feature That's a fair explanation for the first error, but then the second lint error is a bug: it suggests to remove a branch, and applying the fix makes the code (that was working) no longer compile.
a
Lint errors should not be ignored, but warnings can and very well should be suppressed in such cases
Dunno if there's already a bug filed for this
Yes, it can be suppressed, but it's not ideal since you cannot suppress it for just one case, so you lose the lint warnings on all cases, where they could be real issues.
m
Thanks, added as a comment on my issue
o
What is the
new *
source annotation in the screenshot?
Oh, nevermind, it's the VCS author, isn't it?
👌 2