diff --git a/compiler/testData/ir/interpreter/abstract1.kt b/compiler/testData/ir/interpreter/abstract1.kt index ae39f8ab6b3..a9e613ebf67 100644 --- a/compiler/testData/ir/interpreter/abstract1.kt +++ b/compiler/testData/ir/interpreter/abstract1.kt @@ -42,10 +42,10 @@ fun getClassCAsC(num: Int): C { return C(num) } -const val num1 = getAClassImplementation(1).getIntNum() -const val num2 = getBClassImplementation(2).getIntNum() +const val num1 = getAClassImplementation(1).getIntNum() +const val num2 = getBClassImplementation(2).getIntNum() // all `getIntNum` methods are from class C -const val num3 = getClassCAsA(3).getIntNum() -const val num4 = getClassCAsB(4).getIntNum() -const val num5 = getClassCAsC(5).getIntNum() +const val num3 = getClassCAsA(3).getIntNum() +const val num4 = getClassCAsB(4).getIntNum() +const val num5 = getClassCAsC(5).getIntNum() diff --git a/compiler/testData/ir/interpreter/abstract2.kt b/compiler/testData/ir/interpreter/abstract2.kt index 623d9626ed7..a4493c4c369 100644 --- a/compiler/testData/ir/interpreter/abstract2.kt +++ b/compiler/testData/ir/interpreter/abstract2.kt @@ -36,8 +36,8 @@ fun getClassCAsB(num: Int): B { } // all methods call from C -const val num1 = getClassCAsA(1).getIntNum() -const val num2 = getClassCAsB(2).getIntNum() +const val num1 = getClassCAsA(1).getIntNum() +const val num2 = getClassCAsB(2).getIntNum() -const val num3 = getClassCAsA(3).getIntNumInverse() -const val num4 = getClassCAsB(4).getIntNumInverse() +const val num3 = getClassCAsA(3).getIntNumInverse() +const val num4 = getClassCAsB(4).getIntNumInverse() diff --git a/compiler/testData/ir/interpreter/abstract3.kt b/compiler/testData/ir/interpreter/abstract3.kt index b407f9a837a..30eb15b4a5a 100644 --- a/compiler/testData/ir/interpreter/abstract3.kt +++ b/compiler/testData/ir/interpreter/abstract3.kt @@ -41,9 +41,9 @@ fun getClassDAsD(num: Int): D { return D(num) } -const val numA1 = getClassDAsA(1).getInt() -const val numB1 = getClassDAsB(1).getInt() -const val numC1 = getClassDAsC(1).getInt() -const val numC2 = getClassDAsC(1).getString() -const val numD1 = getClassDAsD(1).getInt() -const val numD2 = getClassDAsD(1).getString() +const val numA1 = getClassDAsA(1).getInt() +const val numB1 = getClassDAsB(1).getInt() +const val numC1 = getClassDAsC(1).getInt() +const val numC2 = getClassDAsC(1).getString() +const val numD1 = getClassDAsD(1).getInt() +const val numD2 = getClassDAsD(1).getString() diff --git a/compiler/testData/ir/interpreter/abstract4.kt b/compiler/testData/ir/interpreter/abstract4.kt index e8900e4085a..96e704768d7 100644 --- a/compiler/testData/ir/interpreter/abstract4.kt +++ b/compiler/testData/ir/interpreter/abstract4.kt @@ -34,4 +34,4 @@ class ImplementIterator constructor(val i: Int) : ComplexIterator(i) { @CompileTimeCalculation fun getIterator(i: Int): ComplexIterator = ImplementIterator(i) -const val next = getIterator(10).complexNext() +const val next = getIterator(10).complexNext() diff --git a/compiler/testData/ir/interpreter/collections/arrayConstructor.kt b/compiler/testData/ir/interpreter/collections/arrayConstructor.kt index 89cab568a5d..ac994e6f5f9 100644 Binary files a/compiler/testData/ir/interpreter/collections/arrayConstructor.kt and b/compiler/testData/ir/interpreter/collections/arrayConstructor.kt differ diff --git a/compiler/testData/ir/interpreter/collections/arrayOf.kt b/compiler/testData/ir/interpreter/collections/arrayOf.kt index ef5503d0cae..4ead62e1569 100644 --- a/compiler/testData/ir/interpreter/collections/arrayOf.kt +++ b/compiler/testData/ir/interpreter/collections/arrayOf.kt @@ -17,7 +17,7 @@ fun changeAndReturnSumForObject(array: Array, index: Int, newValue: A): Int { return sum } -const val a = arrayOf(1, 2, 3).size +const val a = arrayOf(1, 2, 3).size const val b = changeAndReturnSum(intArrayOf(1, 2, 3), 0, 10) -const val c = emptyArray().size +const val c = emptyArray().size const val d = changeAndReturnSumForObject(arrayOf(A(1), A(2), A(3)), 0, A(10)) diff --git a/compiler/testData/ir/interpreter/collections/doubleArrayOf.kt b/compiler/testData/ir/interpreter/collections/doubleArrayOf.kt index ae535a7ef81..9722c539c53 100644 --- a/compiler/testData/ir/interpreter/collections/doubleArrayOf.kt +++ b/compiler/testData/ir/interpreter/collections/doubleArrayOf.kt @@ -1,13 +1,13 @@ import kotlin.collections.* -const val doubleArray = arrayOf( +const val doubleArray = arrayOf( arrayOf(1, 2, 3), arrayOf(4, 5), arrayOf(6) -).joinToString(separator = "; ") { it.joinToString() } +).joinToString(separator = "; ") { it.joinToString() } -const val doubleUintArray = arrayOf( +const val doubleUintArray = arrayOf( arrayOf(1u, 2u, 3u), arrayOf(4u, 5u), arrayOf(6u) -).joinToString(separator = "; ") { it.joinToString() } +).joinToString(separator = "; ") { it.joinToString() } diff --git a/compiler/testData/ir/interpreter/collections/doubleList.kt b/compiler/testData/ir/interpreter/collections/doubleList.kt index e34d871057e..2e2645f69f3 100644 --- a/compiler/testData/ir/interpreter/collections/doubleList.kt +++ b/compiler/testData/ir/interpreter/collections/doubleList.kt @@ -1,16 +1,16 @@ import kotlin.collections.* -const val doubleListSize = listOf( +const val doubleListSize = listOf( listOf("1", "2", "3"), listOf("4", "5", "6"), listOf("7", "8", "9") -).size +).size -const val doubleListSizeOfList = listOf( +const val doubleListSizeOfList = listOf( listOf("1"), listOf("4", "5"), listOf("7", "8", "9") -)[2].size +)[2].size const val doubleListGetSingleElement = listOf( listOf("1"), @@ -18,8 +18,8 @@ const val doubleListGetSingleElement = listOf( listOf("7", "8", "9") )[2][2] -const val doubleListElements = listOf( +const val doubleListElements = listOf( listOf("1"), listOf("4", "5"), listOf("7", "8", "9") -).joinToString(separator = "; ") { it.joinToString() } +).joinToString(separator = "; ") { it.joinToString() } diff --git a/compiler/testData/ir/interpreter/collections/listOf.kt b/compiler/testData/ir/interpreter/collections/listOf.kt index 423457901d8..31062a74cd3 100644 --- a/compiler/testData/ir/interpreter/collections/listOf.kt +++ b/compiler/testData/ir/interpreter/collections/listOf.kt @@ -1,8 +1,8 @@ import kotlin.collections.* -const val a = listOf(1, 2, 3).size -const val b = emptyList().size -const val c = listOf().hashCode() +const val a = listOf(1, 2, 3).size +const val b = emptyList().size +const val c = listOf().hashCode() @CompileTimeCalculation fun getSum(list: List): Int { diff --git a/compiler/testData/ir/interpreter/collections/mapOf.kt b/compiler/testData/ir/interpreter/collections/mapOf.kt index 0e592f9ddfc..e0f687385ec 100644 --- a/compiler/testData/ir/interpreter/collections/mapOf.kt +++ b/compiler/testData/ir/interpreter/collections/mapOf.kt @@ -1,18 +1,18 @@ import kotlin.* import kotlin.collections.* -const val a = mapOf(1 to "1", 2 to "2", 3 to "3").size -const val b = emptyMap().size +const val a = mapOf(1 to "1", 2 to "2", 3 to "3").size +const val b = emptyMap().size -const val contains1 = mapOf(1 to "1", 2 to "2", 3 to "3").containsKey(1) -const val contains2 = mapOf(1 to "1", 2 to "2", 3 to "3").contains(1) -const val contains3 = mapOf(1 to "1", 2 to "2", 3 to "3").contains("1") -const val contains4 = mapOf(1 to "1", 2 to "2", 3 to "3").containsValue("1") +const val contains1 = mapOf(1 to "1", 2 to "2", 3 to "3").containsKey(1) +const val contains2 = mapOf(1 to "1", 2 to "2", 3 to "3").contains(1) +const val contains3 = mapOf(1 to "1", 2 to "2", 3 to "3").contains("1") +const val contains4 = mapOf(1 to "1", 2 to "2", 3 to "3").containsValue("1") -const val get1 = mapOf(1 to "1", 2 to "2", 3 to "3").get(1)!! -const val get2 = mapOf(1 to "1", 2 to "2", 3 to "3")[2]!! -const val get3 = mapOf(1 to "1", 2 to "2", 3 to "3")[0].toString() +const val get1 = mapOf(1 to "1", 2 to "2", 3 to "3").get(1)!! +const val get2 = mapOf(1 to "1", 2 to "2", 3 to "3")[2]!! +const val get3 = mapOf(1 to "1", 2 to "2", 3 to "3")[0].toString() -const val keys = mapOf(1 to "1", 2 to "2", 3 to "3").keys.size -const val values = mapOf(1 to "1", 2 to "2", 3 to "3").values.size -const val entries = mapOf(1 to "1", 2 to "2", 3 to "3").entries.size +const val keys = mapOf(1 to "1", 2 to "2", 3 to "3").keys.size +const val values = mapOf(1 to "1", 2 to "2", 3 to "3").values.size +const val entries = mapOf(1 to "1", 2 to "2", 3 to "3").entries.size diff --git a/compiler/testData/ir/interpreter/collections/mutableListOf.kt b/compiler/testData/ir/interpreter/collections/mutableListOf.kt index 20b68166440..817dee082d1 100644 --- a/compiler/testData/ir/interpreter/collections/mutableListOf.kt +++ b/compiler/testData/ir/interpreter/collections/mutableListOf.kt @@ -27,11 +27,11 @@ fun testIterator(mutableList: MutableList): String { return "Sum = " + sum } -const val emptyMutableListSize = mutableListOf().size -const val mutableListSize = mutableListOf(1, 2, 3).size +const val emptyMutableListSize = mutableListOf().size +const val mutableListSize = mutableListOf(1, 2, 3).size const val mutableListAdd = testAdd(mutableListOf(1, 2, 3), 4) const val mutableListRemove1 = testRemove(mutableListOf("1", "2", "3"), "1") const val mutableListRemove2 = testRemove(mutableListOf("1", "2", "3"), "4") const val mutableListAddAll = testAddAll(mutableListOf(1.0, 2.0, 3.0), listOf(4.333, -5.5)) const val mutableListSum = testIterator(mutableListOf(1, (-2).toByte(), 127, 10, 0)) -const val mutableListSubList = mutableListOf(1, 2, 3, 4).subList(0, 2).size +const val mutableListSubList = mutableListOf(1, 2, 3, 4).subList(0, 2).size diff --git a/compiler/testData/ir/interpreter/collections/mutableMapOf.kt b/compiler/testData/ir/interpreter/collections/mutableMapOf.kt index 6e5720fddf6..59a3e484094 100644 --- a/compiler/testData/ir/interpreter/collections/mutableMapOf.kt +++ b/compiler/testData/ir/interpreter/collections/mutableMapOf.kt @@ -1,6 +1,6 @@ import kotlin.* import kotlin.collections.* -const val a1 = mutableMapOf(1 to "1", 2 to "2", 3 to "3").size -const val a2 = mutableMapOf(1 to "1", 2 to "2", 3 to "3").apply { remove(1) }.size +const val a1 = mutableMapOf(1 to "1", 2 to "2", 3 to "3").size +const val a2 = mutableMapOf(1 to "1", 2 to "2", 3 to "3").apply { remove(1) }.size diff --git a/compiler/testData/ir/interpreter/collections/mutableSetOf.kt b/compiler/testData/ir/interpreter/collections/mutableSetOf.kt index cfcff25c8bd..2d43f31c7cc 100644 --- a/compiler/testData/ir/interpreter/collections/mutableSetOf.kt +++ b/compiler/testData/ir/interpreter/collections/mutableSetOf.kt @@ -27,8 +27,8 @@ fun testIterator(mutableSet: MutableSet): String { return "Sum = " + sum } -const val emptyMutableSetSize = mutableSetOf().size -const val mutableSetSize = mutableSetOf(1, 2, 3).size +const val emptyMutableSetSize = mutableSetOf().size +const val mutableSetSize = mutableSetOf(1, 2, 3).size const val mutableSetAdd = testAdd(mutableSetOf(1, 2, 3), 4) const val mutableSetRemove1 = testRemove(mutableSetOf("1", "2", "3"), "1") const val mutableSetRemove2 = testRemove(mutableSetOf("1", "2", "3"), "4") diff --git a/compiler/testData/ir/interpreter/collections/sequenceOf.kt b/compiler/testData/ir/interpreter/collections/sequenceOf.kt index 40dfa2ffb16..218a3bbfcf5 100644 --- a/compiler/testData/ir/interpreter/collections/sequenceOf.kt +++ b/compiler/testData/ir/interpreter/collections/sequenceOf.kt @@ -1,6 +1,6 @@ import kotlin.sequences.* -const val a = sequenceOf(1, 2, 3).iterator().next() -const val b = sequenceOf(2, 3).iterator().next() -const val c = sequenceOf().iterator().hasNext() -const val d = generateSequence() { 42 }.iterator().next() +const val a = sequenceOf(1, 2, 3).iterator().next() +const val b = sequenceOf(2, 3).iterator().next() +const val c = sequenceOf().iterator().hasNext() +const val d = generateSequence() { 42 }.iterator().next() diff --git a/compiler/testData/ir/interpreter/collections/setOf.kt b/compiler/testData/ir/interpreter/collections/setOf.kt index 336dcdda7c1..08d93d5f3db 100644 --- a/compiler/testData/ir/interpreter/collections/setOf.kt +++ b/compiler/testData/ir/interpreter/collections/setOf.kt @@ -1,9 +1,9 @@ import kotlin.collections.* -const val a1 = setOf(1, 2, 3).size -const val a2 = setOf(1, 2, 3, 3, 2, 1).size -const val b = emptySet().size -const val c = setOf().hashCode() +const val a1 = setOf(1, 2, 3).size +const val a2 = setOf(1, 2, 3, 3, 2, 1).size +const val b = emptySet().size +const val c = setOf().hashCode() @CompileTimeCalculation fun getSum(set: Set): Int { diff --git a/compiler/testData/ir/interpreter/companionOverride.kt b/compiler/testData/ir/interpreter/companionOverride.kt index 196842a82d0..6cb234c8a6c 100644 --- a/compiler/testData/ir/interpreter/companionOverride.kt +++ b/compiler/testData/ir/interpreter/companionOverride.kt @@ -27,6 +27,6 @@ class C { } } -const val a = A.get() -const val c1 = C.defaultGet() -const val c2 = C.get() +const val a = A.get() +const val c1 = C.defaultGet() +const val c2 = C.get() diff --git a/compiler/testData/ir/interpreter/composition.kt b/compiler/testData/ir/interpreter/composition.kt index 011772c9dbc..0602e0554e8 100644 --- a/compiler/testData/ir/interpreter/composition.kt +++ b/compiler/testData/ir/interpreter/composition.kt @@ -50,22 +50,22 @@ open class C @CompileTimeCalculation constructor(@CompileTimeCalculation val c: } } -const val a1 = A(1).get() -const val a2 = A(1).setA(2).get() -const val a3 = A(1).openGet() +const val a1 = A(1).get() +const val a2 = A(1).setA(2).get() +const val a3 = A(1).openGet() -const val b1 = B(1).getAFromB() -const val b2 = B(1).getFromProperty() -const val b3 = B(1).aObj.get() -const val b4 = B(1).aObj.setA(-1).get() -const val b5 = B(1).aObj.a +const val b1 = B(1).getAFromB() +const val b2 = B(1).getFromProperty() +const val b3 = B(1).aObj.get() +const val b4 = B(1).aObj.setA(-1).get() +const val b5 = B(1).aObj.a -const val c1 = C(1).getAFromC() -const val c2 = C(1).getBFromC() -const val c3 = C(1).aObj.get() -const val c4 = C(1).openGet() -const val c5 = C(1).bObj.getAFromB() -const val c6 = C(1).bObj.getFromProperty() -const val c7 = C(1).bObj.aObj.setA(-2).get() -const val c8 = C(1).bObj.b -const val c9 = C(1).aObj.a +const val c1 = C(1).getAFromC() +const val c2 = C(1).getBFromC() +const val c3 = C(1).aObj.get() +const val c4 = C(1).openGet() +const val c5 = C(1).bObj.getAFromB() +const val c6 = C(1).bObj.getFromProperty() +const val c7 = C(1).bObj.aObj.setA(-2).get() +const val c8 = C(1).bObj.b +const val c9 = C(1).aObj.a diff --git a/compiler/testData/ir/interpreter/copyReceivedValue.kt b/compiler/testData/ir/interpreter/copyReceivedValue.kt index fe01f61add1..c5bcda5c475 100644 --- a/compiler/testData/ir/interpreter/copyReceivedValue.kt +++ b/compiler/testData/ir/interpreter/copyReceivedValue.kt @@ -5,4 +5,4 @@ fun Int.minusOne(): Int { return this } -const val a = 5.minusOne() +const val a = 5.minusOne() diff --git a/compiler/testData/ir/interpreter/dataClass.kt b/compiler/testData/ir/interpreter/dataClass.kt index 7ab13ee43e8..1a96bf63269 100644 --- a/compiler/testData/ir/interpreter/dataClass.kt +++ b/compiler/testData/ir/interpreter/dataClass.kt @@ -7,21 +7,21 @@ fun Person.getAsString(): String { return "Person name is $name and his phone is $phone" } -const val a1 = Person("John", 123456).name -const val a2 = Person("John", 123456).component1() -const val a3 = Person("John", 123456).phone -const val a4 = Person("John", 123456).component2() +const val a1 = Person("John", 123456).name +const val a2 = Person("John", 123456).component1() +const val a3 = Person("John", 123456).phone +const val a4 = Person("John", 123456).component2() -const val b1 = Person("John", 789).copy("Adam").toString() -const val b2 = Person("John", 789).copy("Adam", 123).toString() +const val b1 = Person("John", 789).copy("Adam").toString() +const val b2 = Person("John", 789).copy("Adam", 123).toString() -const val c = Person("John", 123456).equals(Person("John", 123456)) -const val d = Person("John", 123456).getAsString() +const val c = Person("John", 123456).equals(Person("John", 123456)) +const val d = Person("John", 123456).getAsString() @CompileTimeCalculation data class WithArray(val array: Array<*>?, val intArray: IntArray?) -const val e1 = WithArray(arrayOf(1, 2.0), intArrayOf(1, 2, 3)).toString() -const val e2 = WithArray(null, intArrayOf(1, 2, 3)).toString() -const val e3 = WithArray(arrayOf("1", false), null).toString() -const val e4 = WithArray(null, null).toString() +const val e1 = WithArray(arrayOf(1, 2.0), intArrayOf(1, 2, 3)).toString() +const val e2 = WithArray(null, intArrayOf(1, 2, 3)).toString() +const val e3 = WithArray(arrayOf("1", false), null).toString() +const val e4 = WithArray(null, null).toString() diff --git a/compiler/testData/ir/interpreter/defaultArgs.kt b/compiler/testData/ir/interpreter/defaultArgs.kt index 94b2091b8a7..7406b45dc68 100644 --- a/compiler/testData/ir/interpreter/defaultArgs.kt +++ b/compiler/testData/ir/interpreter/defaultArgs.kt @@ -20,9 +20,9 @@ const val sumBasedOnPrevious1 = sumBasedOnPrevious() const val sumBasedOnPrevious2 = sumBasedOnPrevious(b = 1, c = 1) const val sumBasedOnPrevious3 = sumBasedOnPrevious(a = 1, c = 1) -const val sumInInterfaceDefault1 = B().foo(1) -const val sumInInterfaceDefault2 = B().foo(x = 1, y = 2) -const val sumInInterfaceDefault3 = B().foo(x = 1, y = 2, z = -1) +const val sumInInterfaceDefault1 = B().foo(1) +const val sumInInterfaceDefault2 = B().foo(x = 1, y = 2) +const val sumInInterfaceDefault3 = B().foo(x = 1, y = 2, z = -1) const val someConstProp = 0 @CompileTimeCalculation @@ -38,12 +38,12 @@ class Outer { } } -const val inner1 = Outer().Inner().withInner(100) -const val inner2 = Outer().Inner().withInner() -const val inner3 = Outer().Inner().withOuter(100) -const val inner4 = Outer().Inner().withOuter() -const val inner5 = Outer().Inner().withGlobal(100) -const val inner6 = Outer().Inner().withGlobal() +const val inner1 = Outer().Inner().withInner(100) +const val inner2 = Outer().Inner().withInner() +const val inner3 = Outer().Inner().withOuter(100) +const val inner4 = Outer().Inner().withOuter() +const val inner5 = Outer().Inner().withGlobal(100) +const val inner6 = Outer().Inner().withGlobal() @CompileTimeCalculation interface I { @@ -59,5 +59,5 @@ open class C { @CompileTimeCalculation class D(override val prop: Int): C(), I {} -const val fooB1 = D(10).foo() -const val fooB2 = D(10).foo(-1) +const val fooB1 = D(10).foo() +const val fooB2 = D(10).foo(-1) diff --git a/compiler/testData/ir/interpreter/defaultEquals.kt b/compiler/testData/ir/interpreter/defaultEquals.kt index 84617eae19a..76664964d4b 100644 --- a/compiler/testData/ir/interpreter/defaultEquals.kt +++ b/compiler/testData/ir/interpreter/defaultEquals.kt @@ -9,5 +9,5 @@ fun theSameObjectEquals(value: Any): Boolean { return value == getTheSameValue(value) && value === getTheSameValue(value) } -const val equals1 = A().equals(A()) +const val equals1 = A().equals(A()) const val equals2 = theSameObjectEquals(A()) diff --git a/compiler/testData/ir/interpreter/enums1.kt b/compiler/testData/ir/interpreter/enums1.kt index b1a518fd548..d61186992d2 100644 --- a/compiler/testData/ir/interpreter/enums1.kt +++ b/compiler/testData/ir/interpreter/enums1.kt @@ -6,20 +6,20 @@ enum class EnumClass { VALUE1, VALUE2 } -const val a = EnumClass.VALUE1.name -const val b = EnumClass.values().size -const val c = EnumClass.valueOf("VALUE1").ordinal -const val d = EnumClass.valueOf("VALUE3").EnumClass.VALUE1.name +const val b = EnumClass.values().size +const val c = EnumClass.valueOf("VALUE1").ordinal +const val d = (enums1.kt:12)`!>ordinal + at Enums1Kt.(enums1.kt:12)`!>EnumClass.valueOf("VALUE3").ordinal -const val e1 = EnumClass.VALUE1.hashCode().let { it is Int && it > 0 && it == EnumClass.VALUE1.hashCode() } -const val e2 = EnumClass.VALUE1.toString() +const val e1 = EnumClass.VALUE1.hashCode().let { it is Int && it > 0 && it == EnumClass.VALUE1.hashCode() } +const val e2 = EnumClass.VALUE1.toString() const val e3 = EnumClass.VALUE1 == EnumClass.VALUE1 const val e4 = EnumClass.VALUE1 == EnumClass.VALUE2 -const val f1 = enumValues().size -const val f2 = enumValueOf("VALUE1").name +const val f1 = enumValues().size +const val f2 = enumValueOf("VALUE1").name -const val j1 = enumValues().joinToString { it.name } +const val j1 = enumValues().joinToString { it.name } diff --git a/compiler/testData/ir/interpreter/enums2.kt b/compiler/testData/ir/interpreter/enums2.kt index bc0a0e020fc..cd86ea6a498 100644 --- a/compiler/testData/ir/interpreter/enums2.kt +++ b/compiler/testData/ir/interpreter/enums2.kt @@ -15,15 +15,15 @@ enum class Color(val rgb: Int) { fun getColorAsInt(): Int = rgb } -const val a1 = Empty.values().size -const val a2 = enumValues().size +const val a1 = Empty.values().size +const val a2 = enumValues().size -const val b1 = Color.BLACK.name -const val b2 = Color.BLACK.getColorAsString() -const val b3 = Color.RED.getColorAsString() +const val b1 = Color.BLACK.name +const val b2 = Color.BLACK.getColorAsString() +const val b3 = Color.RED.getColorAsString() -const val c1 = Color.BLACK.getColorAsInt() -const val c2 = Color.RED.getColorAsInt() +const val c1 = Color.BLACK.getColorAsInt() +const val c2 = Color.RED.getColorAsInt() @CompileTimeCalculation enum class EnumWithoutPrimary { @@ -37,5 +37,5 @@ enum class EnumWithoutPrimary { } } -const val d1 = EnumWithoutPrimary.X.someProp -const val d2 = EnumWithoutPrimary.Y.someProp +const val d1 = EnumWithoutPrimary.X.someProp +const val d2 = EnumWithoutPrimary.Y.someProp diff --git a/compiler/testData/ir/interpreter/enums3.kt b/compiler/testData/ir/interpreter/enums3.kt index dbd5741e83d..3c6851cac45 100644 --- a/compiler/testData/ir/interpreter/enums3.kt +++ b/compiler/testData/ir/interpreter/enums3.kt @@ -1,9 +1,9 @@ import kotlin.text.* -const val a = RegexOption.IGNORE_CASE.name -const val b = RegexOption.IGNORE_CASE.ordinal -const val c = RegexOption.MULTILINE.name -const val d = RegexOption.MULTILINE.ordinal +const val a = RegexOption.IGNORE_CASE.name +const val b = RegexOption.IGNORE_CASE.ordinal +const val c = RegexOption.MULTILINE.name +const val d = RegexOption.MULTILINE.ordinal const val e = RegexOption.IGNORE_CASE == RegexOption.IGNORE_CASE const val f = RegexOption.IGNORE_CASE != RegexOption.MULTILINE -const val g = RegexOption.IGNORE_CASE.toString() +const val g = RegexOption.IGNORE_CASE.toString() diff --git a/compiler/testData/ir/interpreter/exceptions/classCastException.kt b/compiler/testData/ir/interpreter/exceptions/classCastException.kt index 3edab5d8aa9..13f175f49af 100644 --- a/compiler/testData/ir/interpreter/exceptions/classCastException.kt +++ b/compiler/testData/ir/interpreter/exceptions/classCastException.kt @@ -49,25 +49,25 @@ const val c2 = (classCastException.kt:48)`!>unsafeClassCast() -const val d1 = A().unsafeCast() -const val d2 = A().A().unsafeCast() +const val d2 = (classCastException.kt:51)`!>unsafeCast() + at ClassCastExceptionKt.(classCastException.kt:51)`!>A().unsafeCast() -const val stringList = getIntList>().(classCastException.kt:54) at ClassCastExceptionKt.stringList.Function$0.invoke(classCastException.kt:0) at StandardKt.kotlin.let(Standard.kt:32) - at ClassCastExceptionKt.(classCastException.kt:53)`!>let { + at ClassCastExceptionKt.(classCastException.kt:53)`!>getIntList>().let { it[0].length } -const val nullableStringList = getStringNullableList>().(classCastException.kt) at ClassCastExceptionKt.nullableStringList.Function$0.invoke(classCastException.kt:0) at StandardKt.kotlin.let(Standard.kt:32) - at ClassCastExceptionKt.(classCastException.kt:56)`!>let { it[0].length } + at ClassCastExceptionKt.(classCastException.kt:56)`!>getStringNullableList>().let { it[0].length } const val nullableStringLength = (classCastException.kt:31)`!>getLength(getStringNullableList>()[0]) diff --git a/compiler/testData/ir/interpreter/exceptions/exceptionWithCause.kt b/compiler/testData/ir/interpreter/exceptions/exceptionWithCause.kt index ecbea650c07..2cecaaf2f1d 100644 --- a/compiler/testData/ir/interpreter/exceptions/exceptionWithCause.kt +++ b/compiler/testData/ir/interpreter/exceptions/exceptionWithCause.kt @@ -31,7 +31,7 @@ class Junk { private fun e(): Nothing = throw LowLevelException() } -const val exceptionWithCause = Junk().a().(exceptionWithCause.kt:34) @@ -46,4 +46,4 @@ Caused by: LowLevelException at ExceptionWithCauseKt.Junk.c(exceptionWithCause.kt:23) at ExceptionWithCauseKt.Junk.b(exceptionWithCause.kt:19) at ExceptionWithCauseKt.Junk.a(exceptionWithCause.kt:13) - at ExceptionWithCauseKt.(exceptionWithCause.kt:34)`!>toString() + at ExceptionWithCauseKt.(exceptionWithCause.kt:34)`!>Junk().a().toString() diff --git a/compiler/testData/ir/interpreter/extensionReceiver.kt b/compiler/testData/ir/interpreter/extensionReceiver.kt index 65b6d41c16d..0eaf0735e7b 100644 --- a/compiler/testData/ir/interpreter/extensionReceiver.kt +++ b/compiler/testData/ir/interpreter/extensionReceiver.kt @@ -14,6 +14,6 @@ class A(val length: Int) { } } -const val simple = 1.get() -const val right = A(3).check("123") -const val wrong = A(2).check("123") +const val simple = 1.get() +const val right = A(3).check("123") +const val wrong = A(2).check("123") diff --git a/compiler/testData/ir/interpreter/generatedStdlib/contains.kt b/compiler/testData/ir/interpreter/generatedStdlib/contains.kt index 7110def158a..c63c5087f1b 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/contains.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/contains.kt @@ -1,7 +1,7 @@ import kotlin.collections.* import kotlin.sequences.* -const val a = intArrayOf(1, 2, 3).contains(1) -const val b = intArrayOf(1, 2, 3).contains(4) -const val c = arrayOf(1, "2", 3.0).contains("2") -const val d = sequenceOf(1, 2, 3).contains(2) +const val a = intArrayOf(1, 2, 3).contains(1) +const val b = intArrayOf(1, 2, 3).contains(4) +const val c = arrayOf(1, "2", 3.0).contains("2") +const val d = sequenceOf(1, 2, 3).contains(2) diff --git a/compiler/testData/ir/interpreter/generatedStdlib/elementAtOrElse.kt b/compiler/testData/ir/interpreter/generatedStdlib/elementAtOrElse.kt index 0b45c5bdb36..6174f4ad2ca 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/elementAtOrElse.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/elementAtOrElse.kt @@ -2,8 +2,8 @@ import kotlin.* import kotlin.collections.* import kotlin.text.* -const val a = listOf(1, 2, 3).elementAtOrElse(1) { -1 } -const val b = listOf(1, 2, 3).elementAtOrElse(4) { -1 } -const val c = uintArrayOf(1u, 2u, 3u, 4u).elementAtOrElse(2) { 0u } -const val d = "abcd".elementAtOrElse(2) { '0' } -const val e = "abcd".elementAtOrElse(4) { '0' } +const val a = listOf(1, 2, 3).elementAtOrElse(1) { -1 } +const val b = listOf(1, 2, 3).elementAtOrElse(4) { -1 } +const val c = uintArrayOf(1u, 2u, 3u, 4u).elementAtOrElse(2) { 0u } +const val d = "abcd".elementAtOrElse(2) { '0' } +const val e = "abcd".elementAtOrElse(4) { '0' } diff --git a/compiler/testData/ir/interpreter/generatedStdlib/first.kt b/compiler/testData/ir/interpreter/generatedStdlib/first.kt index 4f6af978191..36d9af346fc 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/first.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/first.kt @@ -2,10 +2,10 @@ import kotlin.* import kotlin.collections.* import kotlin.text.* -const val a = "abcs".first() -const val b = UIntArray(3) { it.toUInt() }.first() +const val a = "abcs".first() +const val b = UIntArray(3) { it.toUInt() }.first() const val c = listOf(1, "2", 3.0).first() as Int -const val d = listOf().(first.kt:8)`!>first() + at FirstKt.(first.kt:8)`!>listOf().first() diff --git a/compiler/testData/ir/interpreter/generatedStdlib/joinToString.kt b/compiler/testData/ir/interpreter/generatedStdlib/joinToString.kt index b72e5c2d77a..68ca3970663 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/joinToString.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/joinToString.kt @@ -1,5 +1,5 @@ import kotlin.collections.* import kotlin.sequences.* -const val a = listOf(1, 2, 3).joinToString() -const val b = sequenceOf(-1, -2, -3).joinToString(separator = ".") +const val a = listOf(1, 2, 3).joinToString() +const val b = sequenceOf(-1, -2, -3).joinToString(separator = ".") diff --git a/compiler/testData/ir/interpreter/generatedStdlib/toList.kt b/compiler/testData/ir/interpreter/generatedStdlib/toList.kt index bcd6166f419..6be16be76d2 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/toList.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/toList.kt @@ -3,14 +3,14 @@ import kotlin.collections.* import kotlin.text.* import kotlin.sequences.* -const val zeroElementIntArrayToList = intArrayOf().toList().size -const val singleElementIntArrayToList = intArrayOf(1).toList().size -const val intArrayToList = intArrayOf(1, 2, 3).toList().size +const val zeroElementIntArrayToList = intArrayOf().toList().size +const val singleElementIntArrayToList = intArrayOf(1).toList().size +const val intArrayToList = intArrayOf(1, 2, 3).toList().size const val customArrayToList = arrayOf(1, "2", 3.0, "Some other value").toList()[3] as String -const val listFromSet = setOf(1, 2, 2, 3, 3).toList().joinToString() -const val listFromIterable = mapOf(1 to "One", 2 to "Two", 3 to "Three").entries.toList().joinToString() +const val listFromSet = setOf(1, 2, 2, 3, 3).toList().joinToString() +const val listFromIterable = mapOf(1 to "One", 2 to "Two", 3 to "Three").entries.toList().joinToString() -const val stringToList = "String".toList().joinToString() +const val stringToList = "String".toList().joinToString() -const val sequenceToList = sequenceOf(3, 2, 1).toList().joinToString() +const val sequenceToList = sequenceOf(3, 2, 1).toList().joinToString() diff --git a/compiler/testData/ir/interpreter/generatedStdlib/trim.kt b/compiler/testData/ir/interpreter/generatedStdlib/trim.kt index 0fa3c91dfc3..2e088d41d92 100644 --- a/compiler/testData/ir/interpreter/generatedStdlib/trim.kt +++ b/compiler/testData/ir/interpreter/generatedStdlib/trim.kt @@ -1,5 +1,5 @@ import kotlin.text.* -const val trimmed = " 1 ".trim() -const val trimmedWithPredicate = (" 2 " as CharSequence).trim { it.isWhitespace() }.toString() -const val charSequenceTrim = (" 3 " as CharSequence).trim().toString() +const val trimmed = " 1 ".trim() +const val trimmedWithPredicate = (" 2 " as CharSequence).trim { it.isWhitespace() }.toString() +const val charSequenceTrim = (" 3 " as CharSequence).trim().toString() diff --git a/compiler/testData/ir/interpreter/innerClass.kt b/compiler/testData/ir/interpreter/innerClass.kt index 12a6eb5699c..30930212cf0 100644 --- a/compiler/testData/ir/interpreter/innerClass.kt +++ b/compiler/testData/ir/interpreter/innerClass.kt @@ -20,11 +20,11 @@ class Outer { } } -const val a1 = Outer().foo() -const val a2 = Outer().Middle().foo() -const val a3 = Outer().Middle().Inner().foo() +const val a1 = Outer().foo() +const val a2 = Outer().Middle().foo() +const val a3 = Outer().Middle().Inner().foo() -const val b = Outer().Middle().Inner().getAllNums() +const val b = Outer().Middle().Inner().getAllNums() open class A(val s: String) { val z = s @@ -45,4 +45,4 @@ open class A(val s: String) { } } -const val c = A("Fail").B("OK").testB() +const val c = A("Fail").B("OK").testB() diff --git a/compiler/testData/ir/interpreter/instanceOf.kt b/compiler/testData/ir/interpreter/instanceOf.kt index ef73770888f..d8f5c5afb66 100644 --- a/compiler/testData/ir/interpreter/instanceOf.kt +++ b/compiler/testData/ir/interpreter/instanceOf.kt @@ -27,9 +27,9 @@ fun foo(): Unit {} @CompileTimeCalculation fun bar(p1: Int): Unit {} -const val d1 =::foo is kotlin.reflect.KFunction<*> -const val d2 =::foo is Function0<*> -const val d3 =::foo is Function1<*, *> -const val d4 =::bar is kotlin.reflect.KFunction<*> -const val d5 =::bar is Function0<*> -const val d6 =::bar is Function1<*, *> +const val d1 = ::foo is kotlin.reflect.KFunction<*> +const val d2 = ::foo is Function0<*> +const val d3 = ::foo is Function1<*, *> +const val d4 = ::bar is kotlin.reflect.KFunction<*> +const val d5 = ::bar is Function0<*> +const val d6 = ::bar is Function1<*, *> diff --git a/compiler/testData/ir/interpreter/instanceOfWithTypeParameters.kt b/compiler/testData/ir/interpreter/instanceOfWithTypeParameters.kt index 825a5ac5521..b24f7ba885b 100644 --- a/compiler/testData/ir/interpreter/instanceOfWithTypeParameters.kt +++ b/compiler/testData/ir/interpreter/instanceOfWithTypeParameters.kt @@ -135,4 +135,4 @@ fun checkForArray(value: T): String { if (value !is ArrayList<*>?) sb.append("fail 4; ") return if (sb.isEmpty()) "OK" else sb.toString() -} \ No newline at end of file +} diff --git a/compiler/testData/ir/interpreter/interface.kt b/compiler/testData/ir/interpreter/interface.kt index fd3e562275e..89d04511f4e 100644 --- a/compiler/testData/ir/interpreter/interface.kt +++ b/compiler/testData/ir/interpreter/interface.kt @@ -35,8 +35,8 @@ fun getClassAsC(num: Int): C { return C(num) } -const val num1 = getClassAsA(1).getStr() -const val num2 = getClassAsB(2).getStr() -const val num3 = getClassAsB(3).getInt() -const val num4 = getClassAsC(4).getStr() -const val num5 = getClassAsC(5).getInt() +const val num1 = getClassAsA(1).getStr() +const val num2 = getClassAsB(2).getStr() +const val num3 = getClassAsB(3).getInt() +const val num4 = getClassAsC(4).getStr() +const val num5 = getClassAsC(5).getInt() diff --git a/compiler/testData/ir/interpreter/interfaceDefault.kt b/compiler/testData/ir/interpreter/interfaceDefault.kt index 3fe676dae6a..71ccf7950cd 100644 --- a/compiler/testData/ir/interpreter/interfaceDefault.kt +++ b/compiler/testData/ir/interpreter/interfaceDefault.kt @@ -12,8 +12,8 @@ class B(val b: Int) : A { fun getStrFromB() = "B " + super.getStr() } -const val str1 = B(5).getStr() -const val str2 = B(5).getStrFromB() +const val str1 = B(5).getStr() +const val str2 = B(5).getStrFromB() @CompileTimeCalculation interface C { @@ -26,5 +26,5 @@ class D(override val num: Int) : C { fun getStr() = "D num = " + super.getInt() } -const val num1 = D(10).getInt() -const val num2 = D(10).getStr() +const val num1 = D(10).getInt() +const val num2 = D(10).getStr() diff --git a/compiler/testData/ir/interpreter/jvm/classReference.kt b/compiler/testData/ir/interpreter/jvm/classReference.kt index 7425dac2fe1..ecbf265f511 100644 --- a/compiler/testData/ir/interpreter/jvm/classReference.kt +++ b/compiler/testData/ir/interpreter/jvm/classReference.kt @@ -12,12 +12,12 @@ class A(val a: Int, val b: String) { fun Int.funWithExtension(other: Int) = this + other } -const val aSimpleName = A::class.simpleName!! -const val aQualifiedName = A::class.qualifiedName!! -const val aMembers = A::class.members.joinToString() -const val aConstructors = A::class.constructors.(kotlin.Int, kotlin.String): test.A`!>joinToString() -const val aVisibility = A::class.visibility.toString() -const val aSupertypes = A::class.supertypes.joinToString() +const val aSimpleName = A::class.simpleName!! +const val aQualifiedName = A::class.qualifiedName!! +const val aMembers = A::class.members.joinToString() +const val aConstructors = (kotlin.Int, kotlin.String): test.A`!>A::class.constructors.joinToString() +const val aVisibility = A::class.visibility.toString() +const val aSupertypes = A::class.supertypes.joinToString() @CompileTimeCalculation interface Base @@ -31,14 +31,14 @@ class B(val prop: T) : Base { fun withTypeParameter(num: E) = num.toString() } -const val bMembers = B::class.members..prop: T, fun test.B.get(): T, fun test.B.getThis(): test.B, fun test.B.withTypeParameter(E): kotlin.String, fun test.B.equals(kotlin.Any?): kotlin.Boolean, fun test.B.hashCode(): kotlin.Int, fun test.B.toString(): kotlin.String`!>joinToString() -const val bTypeParameters = B::class.typeParameters.joinToString() -const val bSupertypes = B::class.supertypes., kotlin.Any`!>joinToString() -const val bReturnType1 = B::class.members.toList()[1].returnType.toString() -const val bReturnType2 = B::class.members.toList()[3].returnType.toString() +const val bMembers = .prop: T, fun test.B.get(): T, fun test.B.getThis(): test.B, fun test.B.withTypeParameter(E): kotlin.String, fun test.B.equals(kotlin.Any?): kotlin.Boolean, fun test.B.hashCode(): kotlin.Int, fun test.B.toString(): kotlin.String`!>B::class.members.joinToString() +const val bTypeParameters = B::class.typeParameters.joinToString() +const val bSupertypes = , kotlin.Any`!>B::class.supertypes.joinToString() +const val bReturnType1 = B::class.members.toList()[1].returnType.toString() +const val bReturnType2 = B::class.members.toList()[3].returnType.toString() -const val arguments1 = (B(1)::getThis as KFunction<*>).returnType.arguments.joinToString() -const val arguments2 = (arrayOf(1)::iterator as KFunction<*>).returnType.arguments.joinToString() +const val arguments1 = (B(1)::getThis as KFunction<*>).returnType.arguments.joinToString() +const val arguments2 = (arrayOf(1)::iterator as KFunction<*>).returnType.arguments.joinToString() @CompileTimeCalculation class C { @@ -46,5 +46,5 @@ class C { get() = this.length } -const val cMember = C::class.members.toList()[0].toString() -const val cMemberReturnType = C::class.members.toList()[0].returnType.classifier.toString() +const val cMember = C::class.members.toList()[0].toString() +const val cMemberReturnType = C::class.members.toList()[0].returnType.classifier.toString() diff --git a/compiler/testData/ir/interpreter/jvm/javaStatic.kt b/compiler/testData/ir/interpreter/jvm/javaStatic.kt index b8a577efa61..16bd441a849 100644 --- a/compiler/testData/ir/interpreter/jvm/javaStatic.kt +++ b/compiler/testData/ir/interpreter/jvm/javaStatic.kt @@ -17,10 +17,10 @@ const val floatMinExponent = { java.lang.Float.MIN_EXPONENT const val floatNegInfinity = { java.lang.Float.NEGATIVE_INFINITY }() const val floatPosInfinity = { java.lang.Float.POSITIVE_INFINITY }() -const val booleanFalse = { java.lang.Boolean.FALSE }().toString() -const val booleanTrue = { java.lang.Boolean.TRUE }().toString() +const val booleanFalse = { java.lang.Boolean.FALSE }().toString() +const val booleanTrue = { java.lang.Boolean.TRUE }().toString() -const val charMax = { java.lang.Character.MAX_VALUE }().toInt() -const val charMin = { java.lang.Character.MIN_VALUE }().toInt() +const val charMax = { java.lang.Character.MAX_VALUE }().toInt() +const val charMin = { java.lang.Character.MIN_VALUE }().toInt() const val charSize = { java.lang.Character.SIZE }() const val charBytes = { java.lang.Character.BYTES }() diff --git a/compiler/testData/ir/interpreter/jvm/kProperty2.kt b/compiler/testData/ir/interpreter/jvm/kProperty2.kt index 2a485cc5d8d..d8abfe6d593 100644 --- a/compiler/testData/ir/interpreter/jvm/kProperty2.kt +++ b/compiler/testData/ir/interpreter/jvm/kProperty2.kt @@ -8,4 +8,4 @@ class A(val a: Int) { get() = this.length * a } -const val kproperty2Get = A::class.members.toList()[1].call(A(2), "123").toString() +const val kproperty2Get = A::class.members.toList()[1].call(A(2), "123").toString() diff --git a/compiler/testData/ir/interpreter/jvm/parameterReference.kt b/compiler/testData/ir/interpreter/jvm/parameterReference.kt index 1f7d0b2787c..3578e3245e5 100644 --- a/compiler/testData/ir/interpreter/jvm/parameterReference.kt +++ b/compiler/testData/ir/interpreter/jvm/parameterReference.kt @@ -14,9 +14,9 @@ class A { fun String.get(a: Int) = this } -const val parameters1 = (::withParameters as KFunction<*>).parameters.joinToString() -const val parameters2 = (String::withExtension as KFunction<*>).parameters.joinToString() -const val parameters3 = A::class.members.toList()[0].parameters.joinToString() +const val parameters1 = (::withParameters as KFunction<*>).parameters.joinToString() +const val parameters2 = (String::withExtension as KFunction<*>).parameters.joinToString() +const val parameters3 = A::class.members.toList()[0].parameters.joinToString() // properties @CompileTimeCalculation @@ -25,6 +25,6 @@ class B(val b: Int) { get() = this.length } -const val property0Parameters = B(1)::b.parameters.toString() -const val property1Parameters = B::b.parameters.toString() -const val property2Parameters = B::class.members.toList()[1].parameters.toString() +const val property0Parameters = B(1)::b.parameters.toString() +const val property1Parameters = B::b.parameters.toString() +const val property2Parameters = B::class.members.toList()[1].parameters.toString() diff --git a/compiler/testData/ir/interpreter/localFunction.kt b/compiler/testData/ir/interpreter/localFunction.kt index e412069ee8b..df3cf5d9f9f 100644 --- a/compiler/testData/ir/interpreter/localFunction.kt +++ b/compiler/testData/ir/interpreter/localFunction.kt @@ -47,8 +47,8 @@ fun getNumAfterLocalInvoke(): Int { return a } -const val a = returnTheSameValueFun(2).invoke() -const val b = multiplyByTwo(1).invoke() +const val a = returnTheSameValueFun(2).invoke() +const val b = multiplyByTwo(1).invoke() const val c = checkStackCorrectness() const val d = checkLaterInvoke() const val e = localInline() diff --git a/compiler/testData/ir/interpreter/localObject.kt b/compiler/testData/ir/interpreter/localObject.kt index b54120a1271..f63e8163f58 100644 --- a/compiler/testData/ir/interpreter/localObject.kt +++ b/compiler/testData/ir/interpreter/localObject.kt @@ -15,5 +15,5 @@ class A(val a: Int) { } } -const val a = getLocalObject(10).getNum() -const val b = A(2).localObject.getNum() +const val a = getLocalObject(10).getNum() +const val b = A(2).localObject.getNum() diff --git a/compiler/testData/ir/interpreter/logIntrinsic.kt b/compiler/testData/ir/interpreter/logIntrinsic.kt index 62242c471be..506430aa3b9 100644 --- a/compiler/testData/ir/interpreter/logIntrinsic.kt +++ b/compiler/testData/ir/interpreter/logIntrinsic.kt @@ -32,4 +32,4 @@ fun getSomeInfo(): String { @CompileTimeCalculation inline fun log(info: String, fileNameAndLine: String = sourceLocation()): String { return info + " at " + fileNameAndLine -} \ No newline at end of file +} diff --git a/compiler/testData/ir/interpreter/multipleOverridden.kt b/compiler/testData/ir/interpreter/multipleOverridden.kt index 31f540ad03b..c05d026552c 100644 --- a/compiler/testData/ir/interpreter/multipleOverridden.kt +++ b/compiler/testData/ir/interpreter/multipleOverridden.kt @@ -20,4 +20,4 @@ class D : A(), B, C { } } -const val a = D().get() +const val a = D().get() diff --git a/compiler/testData/ir/interpreter/object.kt b/compiler/testData/ir/interpreter/object.kt index de1b566724b..57d2a132765 100644 --- a/compiler/testData/ir/interpreter/object.kt +++ b/compiler/testData/ir/interpreter/object.kt @@ -21,8 +21,8 @@ object ObjectWithConst { fun concat(first: String, second: Any) = "$first$second" } -const val num = A().a -const val numStatic = A.static -const val numStaticFromFun = A.getStaticNumber() -const val valFromObject = ObjectWithConst.b -const val valFnonConstFromObject = ObjectWithConst.nonConst +const val num = A().a +const val numStatic = A.static +const val numStaticFromFun = A.getStaticNumber() +const val valFromObject = ObjectWithConst.b +const val valFnonConstFromObject = ObjectWithConst.nonConst diff --git a/compiler/testData/ir/interpreter/objectOverride.kt b/compiler/testData/ir/interpreter/objectOverride.kt index 196e56e05db..d9eeb140afb 100644 --- a/compiler/testData/ir/interpreter/objectOverride.kt +++ b/compiler/testData/ir/interpreter/objectOverride.kt @@ -21,7 +21,7 @@ object C : B() { override fun get() = "Default: " + super.defaultGet() + "; from super B: " + super.get() + "; from current: " + "companion C" } -const val a1 = A.defaultGet() -const val a2 = A.get() -const val c1 = C.defaultGet() -const val c2 = C.get() +const val a1 = A.defaultGet() +const val a2 = A.get() +const val c1 = C.defaultGet() +const val c2 = C.get() diff --git a/compiler/testData/ir/interpreter/overrideDifferentName.kt b/compiler/testData/ir/interpreter/overrideDifferentName.kt index e522f69971c..c86e52326c6 100644 --- a/compiler/testData/ir/interpreter/overrideDifferentName.kt +++ b/compiler/testData/ir/interpreter/overrideDifferentName.kt @@ -10,5 +10,5 @@ class B(val b: Int) : A() { } } -const val a = A().inc(10) -const val b = B(10).inc(11) +const val a = A().inc(10) +const val b = B(10).inc(11) diff --git a/compiler/testData/ir/interpreter/overrideExtension.kt b/compiler/testData/ir/interpreter/overrideExtension.kt index dff0d40b466..079f313a216 100644 --- a/compiler/testData/ir/interpreter/overrideExtension.kt +++ b/compiler/testData/ir/interpreter/overrideExtension.kt @@ -10,5 +10,5 @@ class B : A() { override fun String.getSize() = -1 } -const val a = A().returnSizeOf("1234") -const val b = B().returnSizeOf("1234") +const val a = A().returnSizeOf("1234") +const val b = B().returnSizeOf("1234") diff --git a/compiler/testData/ir/interpreter/primitives/charMethods.kt b/compiler/testData/ir/interpreter/primitives/charMethods.kt index c50e57043f0..6353faee677 100644 --- a/compiler/testData/ir/interpreter/primitives/charMethods.kt +++ b/compiler/testData/ir/interpreter/primitives/charMethods.kt @@ -32,7 +32,7 @@ const val a3 = minus('9', '1') const val a4 = minus('9', 1) const val a5 = inc('1') const val a6 = dec('1') -const val a7 = rangeTo('9', '1').last +const val a7 = rangeTo('9', '1').last const val b1 = toByte('1') const val b2 = toChar('2') diff --git a/compiler/testData/ir/interpreter/primitives/intMethods.kt b/compiler/testData/ir/interpreter/primitives/intMethods.kt index d29de799bf7..ac9ee62b7a7 100644 --- a/compiler/testData/ir/interpreter/primitives/intMethods.kt +++ b/compiler/testData/ir/interpreter/primitives/intMethods.kt @@ -133,10 +133,10 @@ const val decrement = dec(3) const val unaryPlus = unaryPlus(3) const val unaryMinus = unaryMinus(3) -const val rangeTo1 = rangeTo(5, 1.toByte()).last -const val rangeTo2 = rangeTo(5, 2.toShort()).last -const val rangeTo3 = rangeTo(5, 3).last -const val rangeTo4 = rangeTo(5, 4L).last +const val rangeTo1 = rangeTo(5, 1.toByte()).last +const val rangeTo2 = rangeTo(5, 2.toShort()).last +const val rangeTo3 = rangeTo(5, 3).last +const val rangeTo4 = rangeTo(5, 4L).last const val shiftLeft = shl(8, 1) const val shiftRight = shr(8, 2) diff --git a/compiler/testData/ir/interpreter/primitives/longMethods.kt b/compiler/testData/ir/interpreter/primitives/longMethods.kt index 02fc311402b..24dd50da98e 100644 --- a/compiler/testData/ir/interpreter/primitives/longMethods.kt +++ b/compiler/testData/ir/interpreter/primitives/longMethods.kt @@ -131,10 +131,10 @@ const val decrement = dec(3L) const val unaryPlus = unaryPlus(3L) const val unaryMinus = unaryMinus(3L) -const val rangeTo1 = rangeTo(5L, 1.toByte()).last -const val rangeTo2 = rangeTo(5L, 2.toShort()).last -const val rangeTo3 = rangeTo(5L, 3).last -const val rangeTo4 = rangeTo(5L, 4L).last +const val rangeTo1 = rangeTo(5L, 1.toByte()).last +const val rangeTo2 = rangeTo(5L, 2.toShort()).last +const val rangeTo3 = rangeTo(5L, 3).last +const val rangeTo4 = rangeTo(5L, 4L).last const val shiftLeft = shl(8L, 1) const val shiftRight = shr(8L, 2) diff --git a/compiler/testData/ir/interpreter/primitives/uInt.kt b/compiler/testData/ir/interpreter/primitives/uInt.kt index bdd461047b1..b891e989f8c 100644 --- a/compiler/testData/ir/interpreter/primitives/uInt.kt +++ b/compiler/testData/ir/interpreter/primitives/uInt.kt @@ -103,7 +103,7 @@ const val rem4 = rem(2u, uLong) const val inc = inc(3u) const val dec = dec(3u) -const val rangeTo = rangeTo(0u, 10u).last +const val rangeTo = rangeTo(0u, 10u).last const val shiftLeft = shl(8u, 1) const val shiftRight = shr(8u, 2) diff --git a/compiler/testData/ir/interpreter/progressionFromClosedRange.kt b/compiler/testData/ir/interpreter/progressionFromClosedRange.kt index 69e9d846741..82d2dec3b14 100644 --- a/compiler/testData/ir/interpreter/progressionFromClosedRange.kt +++ b/compiler/testData/ir/interpreter/progressionFromClosedRange.kt @@ -1,3 +1,3 @@ -const val a = IntProgression.fromClosedRange(0, 10, 1).first -const val b = LongProgression.fromClosedRange(0L, 10L, 1L).last -const val c = CharProgression.fromClosedRange('0', '9', 1).step +const val a = IntProgression.fromClosedRange(0, 10, 1).first +const val b = LongProgression.fromClosedRange(0L, 10L, 1L).last +const val c = CharProgression.fromClosedRange('0', '9', 1).step diff --git a/compiler/testData/ir/interpreter/proxy/customCharSequence.kt b/compiler/testData/ir/interpreter/proxy/customCharSequence.kt index edc71a67c10..d0ee08efef9 100644 --- a/compiler/testData/ir/interpreter/proxy/customCharSequence.kt +++ b/compiler/testData/ir/interpreter/proxy/customCharSequence.kt @@ -7,6 +7,6 @@ class MyCharSequence(val str: String): CharSequence { override fun subSequence(startIndex: Int, endIndex: Int) = str.subSequence(startIndex, endIndex) } -const val sbSize = StringBuilder(MyCharSequence("MyString")).length -const val appendSize = StringBuilder().append(MyCharSequence("MyString")).length -const val subSequenceSize = StringBuilder(StringBuilder(MyCharSequence("MyString")).subSequence(0, 4)).length +const val sbSize = StringBuilder(MyCharSequence("MyString")).length +const val appendSize = StringBuilder().append(MyCharSequence("MyString")).length +const val subSequenceSize = StringBuilder(StringBuilder(MyCharSequence("MyString")).subSequence(0, 4)).length diff --git a/compiler/testData/ir/interpreter/proxy/customEquals.kt b/compiler/testData/ir/interpreter/proxy/customEquals.kt index b1b73b87bc6..a47c15137c0 100644 --- a/compiler/testData/ir/interpreter/proxy/customEquals.kt +++ b/compiler/testData/ir/interpreter/proxy/customEquals.kt @@ -23,4 +23,4 @@ class B(val b: Int) { override fun toString(): String = "B($b)" } const val areEquals = listOf(B(1), B(2)) == listOf(B(1), B(2)) -const val asString = listOf(B(1), B(2)).toString() +const val asString = listOf(B(1), B(2)).toString() diff --git a/compiler/testData/ir/interpreter/proxy/proxyPair.kt b/compiler/testData/ir/interpreter/proxy/proxyPair.kt index 59a3a8741a8..a193d753e6d 100644 --- a/compiler/testData/ir/interpreter/proxy/proxyPair.kt +++ b/compiler/testData/ir/interpreter/proxy/proxyPair.kt @@ -3,6 +3,6 @@ import kotlin.collections.* @CompileTimeCalculation class A(val a: Int) -const val size = mapOf(1 to "A(1)").size -const val first = mapOf(1 to "A(1)").entries.single().key -const val second = mapOf(1 to "A(1)").values.single() +const val size = mapOf(1 to "A(1)").size +const val first = mapOf(1 to "A(1)").entries.single().key +const val second = mapOf(1 to "A(1)").values.single() diff --git a/compiler/testData/ir/interpreter/rangeTo.kt b/compiler/testData/ir/interpreter/rangeTo.kt index 5ff90de921e..8b8f0cc23ce 100644 --- a/compiler/testData/ir/interpreter/rangeTo.kt +++ b/compiler/testData/ir/interpreter/rangeTo.kt @@ -2,7 +2,7 @@ @CompileTimeCalculation internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator() @CompileTimeCalculation public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange -const val range = (1..10).first +const val range = (1..10).first @CompileTimeCalculation fun getIterator(first: Int, last: Int): Int { diff --git a/compiler/testData/ir/interpreter/reference/propertyReference.kt b/compiler/testData/ir/interpreter/reference/propertyReference.kt index 19306c58784..1d92681bddd 100644 --- a/compiler/testData/ir/interpreter/reference/propertyReference.kt +++ b/compiler/testData/ir/interpreter/reference/propertyReference.kt @@ -3,30 +3,30 @@ import kotlin.* @CompileTimeCalculation class A(val a: Int) -const val propertyName = A::a.name -const val propertyGet = A::a.get(A(1)) -const val propertyInvoke = A::a.invoke(A(2)) +const val propertyName = A::a.name +const val propertyGet = A::a.get(A(1)) +const val propertyInvoke = A::a.invoke(A(2)) -const val propertyWithReceiverName = A(10)::a.name -const val propertyWithReceiverGet = A(11)::a.get() -const val propertyWithReceiverInvoke = A(12)::a.invoke() +const val propertyWithReceiverName = A(10)::a.name +const val propertyWithReceiverGet = A(11)::a.get() +const val propertyWithReceiverInvoke = A(12)::a.invoke() @CompileTimeCalculation class B(var b: Int) -const val mutablePropertyName = B::b.name -const val mutablePropertyGet = B::b.get(B(1)) -const val mutablePropertySet = B(2).apply { B::b.set(this, 3) }.b -const val mutablePropertyInvoke = B::b.invoke(B(4)) +const val mutablePropertyName = B::b.name +const val mutablePropertyGet = B::b.get(B(1)) +const val mutablePropertySet = B(2).apply { B::b.set(this, 3) }.b +const val mutablePropertyInvoke = B::b.invoke(B(4)) -const val mutablePropertyWithReceiverName = B(10)::b.name -const val mutablePropertyWithReceiverGet = B(11)::b.get() -const val mutablePropertyWithReceiverSet = B(12).apply { this::b.set(13) }.b -const val mutablePropertyWithReceiverInvoke = B(14)::b.invoke() +const val mutablePropertyWithReceiverName = B(10)::b.name +const val mutablePropertyWithReceiverGet = B(11)::b.get() +const val mutablePropertyWithReceiverSet = B(12).apply { this::b.set(13) }.b +const val mutablePropertyWithReceiverInvoke = B(14)::b.invoke() @CompileTimeCalculation var T.bar : T get() = this set(value) { } -const val barToString = String::bar.toString() +const val barToString = String::bar.toString() diff --git a/compiler/testData/ir/interpreter/regex.kt b/compiler/testData/ir/interpreter/regex.kt index 56393cf4700..33cc49b9f09 100644 --- a/compiler/testData/ir/interpreter/regex.kt +++ b/compiler/testData/ir/interpreter/regex.kt @@ -1,35 +1,35 @@ import kotlin.text.* import kotlin.collections.* -const val regConstructor1 = Regex("pattern").pattern -const val regConstructor2 = Regex("pattern", RegexOption.IGNORE_CASE).options.iterator().next().name -const val regConstructor3 = Regex("pattern", setOf(RegexOption.IGNORE_CASE, RegexOption.MULTILINE)).options.size +const val regConstructor1 = Regex("pattern").pattern +const val regConstructor2 = Regex("pattern", RegexOption.IGNORE_CASE).options.iterator().next().name +const val regConstructor3 = Regex("pattern", setOf(RegexOption.IGNORE_CASE, RegexOption.MULTILINE)).options.size -const val matchEntire1 = Regex("pat").matchEntire("pat")?.value.toString() -const val matchEntire2 = Regex("[abc]").matchEntire("a")?.range?.last.toString() -const val matches1 = Regex("str(1)?").matches("str1") -const val matches2 = Regex("str(1)?").matches("str2") -const val containsMatchIn1 = Regex("[0-9]").containsMatchIn("0") -const val containsMatchIn2 = Regex("[0-9]").containsMatchIn("!!0!!") -const val containsMatchIn3 = Regex("[0-9]").containsMatchIn("!!p!!") +const val matchEntire1 = Regex("pat").matchEntire("pat")?.value.toString() +const val matchEntire2 = Regex("[abc]").matchEntire("a")?.range?.last.toString() +const val matches1 = Regex("str(1)?").matches("str1") +const val matches2 = Regex("str(1)?").matches("str2") +const val containsMatchIn1 = Regex("[0-9]").containsMatchIn("0") +const val containsMatchIn2 = Regex("[0-9]").containsMatchIn("!!0!!") +const val containsMatchIn3 = Regex("[0-9]").containsMatchIn("!!p!!") //replace -const val replace1 = Regex("0").replace("There are 0 apples", "n") -const val replace2 = Regex("(red|green|blue)").replace("Roses are red, Violets are blue") { it.value + "!" } -const val replace3 = Regex("(red|green|blue)").replaceFirst("Roses are red, Violets are blue", "REPLACED") -const val split = Regex("\\W+").split("Roses are red, Violets are blue").size +const val replace1 = Regex("0").replace("There are 0 apples", "n") +const val replace2 = Regex("(red|green|blue)").replace("Roses are red, Violets are blue") { it.value + "!" } +const val replace3 = Regex("(red|green|blue)").replaceFirst("Roses are red, Violets are blue", "REPLACED") +const val split = Regex("\\W+").split("Roses are red, Violets are blue").size //find -const val find1 = Regex("p").find("p")?.value.toString() -const val find2 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.groups?.size.toString() -const val find3 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.destructured?.component1().toString() -const val find4 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.next()?.value.toString() -const val find5 = Regex("(red|green|blue)").find("Roses are red, Violets are blue", 15)?.value.toString() -const val find6 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.value.toString() -const val find7 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.next()?.value.toString() -const val find8 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.next()?.next()?.value.toString() +const val find1 = Regex("p").find("p")?.value.toString() +const val find2 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.groups?.size.toString() +const val find3 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.destructured?.component1().toString() +const val find4 = Regex("(red|green|blue)").find("Roses are red, Violets are blue")?.next()?.value.toString() +const val find5 = Regex("(red|green|blue)").find("Roses are red, Violets are blue", 15)?.value.toString() +const val find6 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.value.toString() +const val find7 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.next()?.value.toString() +const val find8 = Regex("(red|green|blue)").findAll("Roses are red, Violets are blue").iterator().next()?.next()?.next()?.value.toString() //companion -const val fromLiteral = Regex.fromLiteral("[a-z0-9]+").pattern -const val escape = Regex.escape("[a-z0-9]+") -const val escapeReplacement = Regex.escapeReplacement("[a-z0-9]+") +const val fromLiteral = Regex.fromLiteral("[a-z0-9]+").pattern +const val escape = Regex.escape("[a-z0-9]+") +const val escapeReplacement = Regex.escapeReplacement("[a-z0-9]+") diff --git a/compiler/testData/ir/interpreter/safeClassCast.kt b/compiler/testData/ir/interpreter/safeClassCast.kt index f4481db99d9..b39dda553ce 100644 --- a/compiler/testData/ir/interpreter/safeClassCast.kt +++ b/compiler/testData/ir/interpreter/safeClassCast.kt @@ -34,6 +34,6 @@ const val c6 = arrayOf>(listOf(1, 2), listOf(2, const val c7 = Array>(3) { listOf(it, it + 1) } as? Array?> == null const val c8 = Array>(3) { listOf(it, it + 1) } as? Array> == null -const val d1 = arrayCast(arrayOf(1, 2, 3)).size -const val d2 = arrayCast(*arrayOf(1, 2, 3)).size -const val d3 = arrayCast(1, 2, 3).size +const val d1 = arrayCast(arrayOf(1, 2, 3)).size +const val d2 = arrayCast(*arrayOf(1, 2, 3)).size +const val d3 = arrayCast(1, 2, 3).size diff --git a/compiler/testData/ir/interpreter/samConversion.kt b/compiler/testData/ir/interpreter/samConversion.kt index 30d328a63f8..855c9ff662e 100644 --- a/compiler/testData/ir/interpreter/samConversion.kt +++ b/compiler/testData/ir/interpreter/samConversion.kt @@ -8,12 +8,12 @@ fun interface IntPredicate { fun defaultMethod() = 1 } -const val isEven = IntPredicate { it % 2 == 0 } - .let { predicate -> listOf(1, 2, 3, 4, 5).map { predicate.accept(it) }.joinToString() } -const val isOdd = IntPredicate { it % 2 != 0 } - .let { predicate -> listOf(1, 2, 3, 4, 5).map { predicate.accept(it) }.joinToString() } -const val callToDefault = IntPredicate { false }.defaultMethod() -const val callToString = IntPredicate { false }. kotlin.Boolean`!>toString() +const val isEven = IntPredicate { it % 2 == 0 } + .let { predicate -> listOf(1, 2, 3, 4, 5).map { predicate.accept(it) }.joinToString() } +const val isOdd = IntPredicate { it % 2 != 0 } + .let { predicate -> listOf(1, 2, 3, 4, 5).map { predicate.accept(it) }.joinToString() } +const val callToDefault = IntPredicate { false }.defaultMethod() +const val callToString = kotlin.Boolean`!>IntPredicate { false }.toString() @CompileTimeCalculation fun interface KRunnable { diff --git a/compiler/testData/ir/interpreter/scopeFunctions.kt b/compiler/testData/ir/interpreter/scopeFunctions.kt index 322d6059566..3321a9610be 100644 --- a/compiler/testData/ir/interpreter/scopeFunctions.kt +++ b/compiler/testData/ir/interpreter/scopeFunctions.kt @@ -13,23 +13,23 @@ fun echo(value: T): T = value const val a = run { echo("Run block") } -const val b = A(0, "Run with receiver").run { this.str + this.num } +const val b = A(0, "Run with receiver").run { this.str + this.num } const val c = with (A(1, "String")) { setNewStr("New String") this.str } -const val d = A(2, "Apply test").apply { this.setNewStr("New apply str") }.str +const val d = A(2, "Apply test").apply { this.setNewStr("New apply str") }.str -const val e = mutableListOf("one", "two", "three").also { it.add("four") }.size -const val f1 = mutableListOf("one", "two", "three").let { +const val e = mutableListOf("one", "two", "three").also { it.add("four") }.size +const val f1 = mutableListOf("one", "two", "three").let { it.add("four") it.size } -const val f2 = 10.let { it + 10 } +const val f2 = 10.let { it + 10 } -const val g1 = 1.takeIf { it % 2 == 0 }.toString() -const val g2 = 2.takeIf { it % 2 == 0 }.toString() -const val h1 = (-1).takeUnless { it > 0 }.toString() -const val h2 = 1.takeUnless { it > 0 }.toString() +const val g1 = 1.takeIf { it % 2 == 0 }.toString() +const val g2 = 2.takeIf { it % 2 == 0 }.toString() +const val h1 = (-1).takeUnless { it > 0 }.toString() +const val h2 = 1.takeUnless { it > 0 }.toString() diff --git a/compiler/testData/ir/interpreter/secondaryConstructor.kt b/compiler/testData/ir/interpreter/secondaryConstructor.kt index 72b71a77ff8..d4d5c5d67f8 100644 --- a/compiler/testData/ir/interpreter/secondaryConstructor.kt +++ b/compiler/testData/ir/interpreter/secondaryConstructor.kt @@ -20,17 +20,17 @@ class Person(val name: String, val surname: String) { } } -const val a1 = Person("Ivan", "Ivanov").age -const val a2 = Person("Ivan", "Ivanov").wholeName +const val a1 = Person("Ivan", "Ivanov").age +const val a2 = Person("Ivan", "Ivanov").wholeName -const val b1 = Person("Ivan").age -const val b2 = Person("Ivan").`!>wholeName +const val b1 = Person("Ivan").age +const val b2 = `!>Person("Ivan").wholeName -const val c1 = Person().age -const val c2 = Person(). `!>wholeName +const val c1 = Person().age +const val c2 = `!>Person().wholeName -const val d1 = Person("Ivan", 20).age -const val d2 = Person("Ivan", 20).`!>wholeName +const val d1 = Person("Ivan", 20).age +const val d2 = `!>Person("Ivan", 20).wholeName @CompileTimeCalculation class A { @@ -44,5 +44,5 @@ class A { } } -const val e1 = A(true).prop -const val e2 = A(false).prop +const val e1 = A(true).prop +const val e2 = A(false).prop diff --git a/compiler/testData/ir/interpreter/stringBuilder.kt b/compiler/testData/ir/interpreter/stringBuilder.kt index 9952de4031f..ce9e8a8a70d 100644 --- a/compiler/testData/ir/interpreter/stringBuilder.kt +++ b/compiler/testData/ir/interpreter/stringBuilder.kt @@ -8,17 +8,17 @@ fun appendVararg(vararg strings: String): String { } -const val simpleAppend = StringBuilder().append("str").toString() -const val withCapacity = StringBuilder(7).append("example").toString() -const val withContent = StringBuilder("first").append(" ").append("second").toString() +const val simpleAppend = StringBuilder().append("str").toString() +const val withCapacity = StringBuilder(7).append("example").toString() +const val withContent = StringBuilder("first").append(" ").append("second").toString() const val appendInFun = appendVararg("1", " ", "2", " ", "3") -const val length1 = StringBuilder(3).append("1").length -const val length2 = StringBuilder().append("123456789").length -const val get0 = StringBuilder().append("1234556789").get(0) -const val get1 = StringBuilder().append("1234556789").get(1) +const val length1 = StringBuilder(3).append("1").length +const val length2 = StringBuilder().append("123456789").length +const val get0 = StringBuilder().append("1234556789").get(0) +const val get1 = StringBuilder().append("1234556789").get(1) const val subSequence1 = StringBuilder().append("123456789").subSequence(0, 2) as String const val subSequence2 = StringBuilder().append("123456789").subSequence(2, 8) as String -const val appendPart = StringBuilder().append("123456789", 1, 3).toString() -const val appendNull = StringBuilder().append(null as Any?).toString() +const val appendPart = StringBuilder().append("123456789", 1, 3).toString() +const val appendNull = StringBuilder().append(null as Any?).toString() diff --git a/compiler/testData/ir/interpreter/stringConcatenation.kt b/compiler/testData/ir/interpreter/stringConcatenation.kt index 0f45f054904..9451a42008a 100644 --- a/compiler/testData/ir/interpreter/stringConcatenation.kt +++ b/compiler/testData/ir/interpreter/stringConcatenation.kt @@ -56,7 +56,7 @@ const val concatLambda5 = kotlin.String?`!>"" + f const val concatLambda6 = kotlin.String`!>"" + { i: Int -> "" } const val concatLambda7 = kotlin.Unit`!>"" + { } const val concatLambda8 = kotlin.Unit`!>"" + { i: Int, b: Double, c: String -> } -const val concatLambda9 = "". kotlin.String`!>let { +const val concatLambda9 = kotlin.String`!>"".let { val lambdaWith: Double.(Int) -> String = { "A" } lambdaWith.toString() } diff --git a/compiler/testData/ir/interpreter/superClass.kt b/compiler/testData/ir/interpreter/superClass.kt index d2c8fdbace1..790bab8cf8d 100644 --- a/compiler/testData/ir/interpreter/superClass.kt +++ b/compiler/testData/ir/interpreter/superClass.kt @@ -48,23 +48,23 @@ open class E @CompileTimeCalculation constructor(val e: Int) : D(e + 1) { } -const val a1 = A(1).get() -const val a2 = A(1).setA(2).get() -const val a3 = A(1).openGet() -const val a4 = A(1).a // property inherits compile-time annotation from primary constructor +const val a1 = A(1).get() +const val a2 = A(1).setA(2).get() +const val a3 = A(1).openGet() +const val a4 = A(1).a // property inherits compile-time annotation from primary constructor -const val b1 = B(1).getAFromB() -const val b2 = B(1).getFromValueParameter(A(10)) -const val b3 = B(1).get() //fake overridden -const val b4 = B(1).setA(-1).get() +const val b1 = B(1).getAFromB() +const val b2 = B(1).getFromValueParameter(A(10)) +const val b3 = B(1).get() //fake overridden +const val b4 = B(1).setA(-1).get() -const val c1 = C(1).getAFromC() -const val c2 = C(1).get() //fake overridden -const val c3 = C(1).openGet() -const val c4 = C(1).getAFromB() -const val c5 = C(1).getFromValueParameter(A(10)) //method from B -const val c6 = C(1).setA(-2).get() +const val c1 = C(1).getAFromC() +const val c2 = C(1).get() //fake overridden +const val c3 = C(1).openGet() +const val c4 = C(1).getAFromB() +const val c5 = C(1).getFromValueParameter(A(10)) //method from B +const val c6 = C(1).setA(-2).get() // test deep fake overridden -const val d1 = D(1).get() -const val e1 = E(1).get() +const val d1 = D(1).get() +const val e1 = E(1).get() diff --git a/compiler/testData/ir/interpreter/unitResult.kt b/compiler/testData/ir/interpreter/unitResult.kt index f61eb2260f8..cf982b67556 100644 --- a/compiler/testData/ir/interpreter/unitResult.kt +++ b/compiler/testData/ir/interpreter/unitResult.kt @@ -4,9 +4,9 @@ @CompileTimeCalculation fun getUnitImplicitFromTry1(): Unit { try {} finally { 5 } } @CompileTimeCalculation fun getUnitImplicitFromTry2(): Unit { try {} finally { } } -const val unit1 = Unit.toString() -const val unit2 = getUnitImplicit().toString() -const val unit3 = getUnitExplicit().toString() -const val unit4 = getUnitImplicitFromExpression().toString() -const val unit5 = getUnitImplicitFromTry1().toString() -const val unit6 = getUnitImplicitFromTry2().toString() +const val unit1 = Unit.toString() +const val unit2 = getUnitImplicit().toString() +const val unit3 = getUnitExplicit().toString() +const val unit4 = getUnitImplicitFromExpression().toString() +const val unit5 = getUnitImplicitFromTry1().toString() +const val unit6 = getUnitImplicitFromTry2().toString() diff --git a/compiler/testData/ir/interpreter/withReceivers.kt b/compiler/testData/ir/interpreter/withReceivers.kt index c1e22a0caf3..4e77ba0f959 100644 --- a/compiler/testData/ir/interpreter/withReceivers.kt +++ b/compiler/testData/ir/interpreter/withReceivers.kt @@ -18,5 +18,5 @@ fun plus(a: Temp, b: Temp): Double { } } -const val a1 = Temp(1).plus(Temp(2.0)) +const val a1 = Temp(1).plus(Temp(2.0)) const val a2 = plus(Temp(3), Temp(4)) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrInterpreterBackendHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrInterpreterBackendHandler.kt index 94e9ab8bf67..9802998ddfa 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrInterpreterBackendHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/IrInterpreterBackendHandler.kt @@ -39,7 +39,7 @@ open class IrInterpreterBackendHandler(testServices: TestServices) : AbstractIrH private class Evaluator(private val interpreter: IrInterpreter, private val globalMetadataInfoHandler: GlobalMetadataInfoHandler) { fun evaluate(irFile: IrFile, testFile: TestFile) { object : IrElementTransformerVoid() { - private fun IrExpression.report(original: IrExpression): IrExpression { + private fun IrExpression.report(original: IrExpression, startOffsetForDiagnostic: Int? = null): IrExpression { if (this == original) return this val isError = this is IrErrorExpression val message = when (this) { @@ -48,9 +48,10 @@ private class Evaluator(private val interpreter: IrInterpreter, private val glob else -> TODO("unsupported type ${this::class.java}") } val startOffset = when { + startOffsetForDiagnostic != null -> startOffsetForDiagnostic // this additional check is needed to unify rendering from old and new frontends original is IrCall && original.symbol.owner.fqNameWhenAvailable?.asString() == "kotlin.internal.ir.CHECK_NOT_NULL" -> endOffset - 2 - else -> startOffset + else -> original.startOffset } val metaInfo = IrInterpreterCodeMetaInfo(startOffset, this.endOffset, message, isError) globalMetadataInfoHandler.addMetadataInfosForFile(testFile, listOf(metaInfo)) @@ -82,7 +83,10 @@ private class Evaluator(private val interpreter: IrInterpreter, private val glob if (expression is IrConst<*>) return declaration val isConst = declaration.correspondingPropertySymbol?.owner?.isConst == true - if (isConst) initializer.expression = interpreter.interpret(expression, irFile).report(expression) + if (isConst) { + val startOffsetForDiagnostic = declaration.startOffset + "const val = ".length + declaration.name.asString().length + initializer.expression = interpreter.interpret(expression, irFile).report(expression, startOffsetForDiagnostic) + } return declaration } }.visitFile(irFile)