Support Char.code in constant evaluator, KT-46036

But do not consider Char.code a pure integer constant.
This commit is contained in:
Ilya Gorbunov
2021-04-07 17:11:10 +03:00
parent 0a446230f7
commit 8041c3aa1d
10 changed files with 70 additions and 3 deletions
@@ -0,0 +1,8 @@
const val p1: Int = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code<!>
const val p2: Long = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code.toLong()<!>
const val p3: Byte = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code.toByte()<!>
const val p4: Short = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code.toShort()<!>
const val e2: Long = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code<!>
const val e3: Byte = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code<!>
const val e4: Short = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>'\n'.code<!>
@@ -0,0 +1,8 @@
const val p1: Int = '\n'.code
const val p2: Long = '\n'.code.toLong()
const val p3: Byte = '\n'.code.toByte()
const val p4: Short = '\n'.code.toShort()
const val e2: Long = <!TYPE_MISMATCH!>'\n'.code<!>
const val e3: Byte = <!TYPE_MISMATCH!>'\n'.code<!>
const val e4: Short = <!TYPE_MISMATCH!>'\n'.code<!>
@@ -0,0 +1,10 @@
package
public const val e2: kotlin.Long = 10
public const val e3: kotlin.Byte = 10
public const val e4: kotlin.Short = 10
public const val p1: kotlin.Int = 10
public const val p2: kotlin.Long = 10.toLong()
public const val p3: kotlin.Byte = 10.toByte()
public const val p4: kotlin.Short = 10.toShort()