Add possibility to interpret and fold IrStringConcatenation expression

This commit is contained in:
Ivan Kylchik
2023-02-09 12:29:27 +01:00
committed by Space Team
parent 7cf9dda8dc
commit 63b340651d
77 changed files with 305 additions and 184 deletions
@@ -1,19 +0,0 @@
package test
annotation class Ann(
val s1: String,
val s2: String,
val s3: String,
val s4: String
)
val i = 1
@Ann(
s1 = "a$i",
s2 = "a$i b",
s3 = <!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>"$i"<!>,
s4 = "a${i}a$i"
) class MyClass
// EXPECTED: @Ann(s1 = "a1", s2 = "a1 b", s3 = "1", s4 = "a1a1")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package test
annotation class Ann(
@@ -1,9 +0,0 @@
package test
annotation class Ann(val s1: String, val s2: String)
val i = 1
@Ann(s1 = "a" + "b", s2 = "a" + "a$i") class MyClass
// EXPECTED: @Ann(s1 = "ab", s2 = "aa1")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package test
annotation class Ann(val s1: String, val s2: String)
@@ -0,0 +1,16 @@
const val simple = "O${'K'} ${1.toLong() + 2.0}"
const val withInnerConcatenation = "1 ${"2 ${3} ${4} 5"} 6"
object A
object B {
override fun toString(): String = "B"
}
const val printA = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"A: $A"<!>
const val printB = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"B: $B"<!>
const val withNull = "1 ${null}"
const val withNullPlus = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"1" + null<!>
val nonConst = 0
const val withNonConst = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"A $nonConst B"<!>
@@ -0,0 +1,16 @@
const val simple = "O${'K'} ${1.toLong() + 2.0}"
const val withInnerConcatenation = "1 ${"2 ${3} ${4} 5"} 6"
object A
object B {
override fun toString(): String = "B"
}
const val printA = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"A: $A"<!>
const val printB = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"B: $B"<!>
const val withNull = "1 ${null}"
const val withNullPlus = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"1" + null<!>
val nonConst = 0
const val withNonConst = <!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>"A $nonConst B"<!>
@@ -0,0 +1,24 @@
package
public val nonConst: kotlin.Int = 0
public const val printA: kotlin.String
public const val printB: kotlin.String
public const val simple: kotlin.String = "OK 3.0"
public const val withInnerConcatenation: kotlin.String = "1 2 3 4 5 6"
public const val withNonConst: kotlin.String = "A 0 B"
public const val withNull: kotlin.String = "1 null"
public const val withNullPlus: kotlin.String
public object A {
private constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object B {
private constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}