Is this possibly a K2 mode bug in IntelliJ? It's a...
# intellij
k
Is this possibly a K2 mode bug in IntelliJ? It's an expect enum class in kotlinx-datetime
I enabled
-Werror
and compilation fails with the else branch saying it’s unnecessary.
a
If you retype
when
, won't the error go away? I can't reproduce locally and suspect that the highlighting is left from the time when not all enum entries were written.
k
a
Oh, indeed within common code it's reproducible for me as well. Will create a YT issue. Thanks!
k
Awesome. Glad I raised it. Thanks for taking a peek 😄
a
With a help of team mates: it's actually a correct error though not evident at all!
Actual
enum might provide more entries than
expect
enum and thus you would always need
else
branch. You might want to complain about better error message but it's better to do in #C03PK0PE257 probably. Plugin just shows you compiler's error message.
k
Hm, then why does enabling
-Werror
flag the else branch and fail compilation? Either the compiler or IntelliJ is wrong here and I’m not sure which it is 😅
a
I'd say that compiler should not do suggest you to delete
else
branch.
k
Should I flag that in #C7L3JB43G or #C03PK0PE257?
a
Both should do, I believe
blob ty sign 2
k
It seems like this when statement without an else branch shouldn’t compile at all