Deprecate simplification of complex boolean constant expressions in whens and loops
^KT-39883 In Progress
This commit is contained in:
committed by
teamcityserver
parent
8a2e0cedf9
commit
05883afc0a
+32
@@ -0,0 +1,32 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ProhibitSimplificationOfNonTrivialConstBooleanExpressions
|
||||
// ISSUE: KT-39883
|
||||
|
||||
// Should always work
|
||||
fun test_0(b: Boolean): String = when (b) {
|
||||
true -> "true"
|
||||
false -> "false"
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
fun test_1(b: Boolean): String = <!NO_ELSE_IN_WHEN!>when<!> (b) {
|
||||
1 == 1 -> "true"
|
||||
"" != "" -> "false"
|
||||
}
|
||||
|
||||
const val TRUE = true
|
||||
|
||||
// Already not working
|
||||
fun test_2(b: Boolean): String = <!NO_ELSE_IN_WHEN!>when<!>(b) {
|
||||
TRUE -> "true"
|
||||
false -> "false"
|
||||
}
|
||||
|
||||
const val s1 = "s1"
|
||||
const val s2 = "s2"
|
||||
|
||||
// Already not working
|
||||
fun test_3(b: Boolean): String = <!NO_ELSE_IN_WHEN!>when<!>(b) {
|
||||
true -> "true"
|
||||
s1 == s2 -> "false"
|
||||
}
|
||||
Reference in New Issue
Block a user