ribesg
09/26/2018, 8:10 AMwhen
thing in 1.3 RC
is reformatted incorrectly by IDEA:
val value = when (val type = peek()) {
JsonToken.BOOLEAN -> nextBoolean()
JsonToken.NULL -> nextNull().let { null }
else -> throw Error("Unexpected type $type")
}
After auto-formatting:
val value = when (
val type = peek()) {
JsonToken.BOOLEAN -> nextBoolean()
JsonToken.NULL -> nextNull().let { null }
else -> throw Error("Unexpected type $type")
}
There is no matching option under the when
close in Code Style
. Is this a bug / missing feature?
It happens with both the old default IDEA style and the new one.gergo
09/26/2018, 11:10 AMribesg
09/26/2018, 11:37 AMgergo
09/26/2018, 11:38 AMval type = peek()
initializing a variable is not an expression it won't return anything, how do you want to match it's result with when?ribesg
09/26/2018, 11:40 AMgergo
09/26/2018, 11:41 AMcbruegg
09/26/2018, 4:48 PMwhen
documented?kevinmost
09/26/2018, 7:53 PMwhen
subject variable feature