```internal sealed interface Command private data class Connect(...) : Command private data class Su...
f
Copy code
internal sealed interface Command
private data class Connect(...) : Command
private data class Subscribe(
...
) : Command

private data class Publish(...) : Command
private data class ClientConnected(...) : Command
private data class ClientDisconnected(...) : Command
...
//non-exhaustive when here
    when (val cmd : Command = receive()) {
                is Connect -> { true}
                is Subscribe -> {true }
                is Publish -> {true}
                is ClientConnected -> {true}
                is ClientDisconnected -> {true}
            }
r
Is
receive
nullable?
f
no
l
Is it any different if you create cmd on the line before the when and just have when(cmd)?
f
it’s actually in a function
and the code compiles!
e
are they in the same sourceset?
if they aren't, it might be an IDE bug: https://youtrack.jetbrains.com/issue/KTIJ-23916
if they are, it might be an IDE bug: https://youtrack.jetbrains.com/issue/KTIJ-21190
1
f
Nice! It’s because of missing package declaration!
🙌 1
Thanks!