I think there are two separate things here:
• there is a warning for enums and not for sealed classes
• whether or not a when is a lambda is considered an expression depends on the possible (?) return type. I'm curious as to how the exact decision making for this process goes, this is a minimal example:
run {
when(Foo.A) {
Foo.A -> Unit
}
}
run {
when(Foo.A) {
Foo.A -> 5
}
}