I expect the following to pass formatting.
fun broken(letter: Letter): String? = when (letter) {
Letter.A -> if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
throw SecurityException(
"does not have privileged phone permission"
)
}
Letter.B -> if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
null
}
}
Fails with: Missing newline after "->" (indent). Wrapping with { .. } fixes the issue
enum class Letter(val value: String) {
A("a"),
B("b");
}
val hasPrivilegedStatePermission = true
fun broken(letter: Letter): String? = when (letter) {
Letter.A -> if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
throw SecurityException(
"does not have privileged phone permission"
)
}
Letter.B -> if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
null
}
}
fun fixed(letter: Letter): String? = when (letter) {
Letter.A -> {
if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
throw SecurityException(
"does not have privileged phone permission"
)
}
}
Letter.B -> {
if (hasPrivilegedStatePermission) {
"subscriberId"
} else {
null
}
}
}
0.38.1 (command line)4.0.1 with AGP 3.610.15.6This could likely be the same issue and have the same resolution as #898 (but unable to test 39.0 yet)
This is the last issue I found when upgrading to 0.38.1, so no more from me :)
Thanks!
Yes, it fails on master as well.
BTW thank you for detailed bugs description :+1:
Most helpful comment
Yes, it fails on
masteras well.BTW thank you for detailed bugs description :+1: