[K2] Allow using simple boolean expressions in constant position

Such behavior is not the same as in K1, but it is more consistent.

#KT-64400 Fixed
This commit is contained in:
Ivan Kylchik
2023-12-05 16:58:44 +01:00
committed by Space Team
parent 38ea2ce973
commit f8e9e99d87
13 changed files with 129 additions and 40 deletions
@@ -0,0 +1,22 @@
const val INT = 0
const val LONG = 0L
const val compareInt1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 < 2<!>
const val compareInt2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 <= 3<!>
const val compareInt3 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 > 4<!>
const val compareInt4 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 >= 5<!>
const val compareInt5 = INT < 2
const val compareInt6 = INT <= 3
const val compareInt7 = INT > 4
const val compareInt8 = INT >= 5
const val compareLong1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1L < 2L<!>
const val compareLong2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1L <= 3L<!>
const val compareLong3 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1L > 4L<!>
const val compareLong4 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1L >= 5L<!>
const val compareLong5 = LONG < 2L
const val compareLong6 = LONG <= 3L
const val compareLong7 = LONG > 4L
const val compareLong8 = LONG >= 5L