From 9c974b6c5c8ba6a61f0e682dda5d74877ba8e340 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 15 Sep 2015 18:28:32 +0300 Subject: [PATCH] Fix deprecations in testData: BlackBoxWithStdLibCodegenTest --- .../boxWithStdlib/dataClasses/doubleParam.kt | 2 +- .../dataClasses/equals/genericarray.kt | 2 +- .../dataClasses/equals/intarray.kt | 2 +- .../boxWithStdlib/dataClasses/floatParam.kt | 2 +- .../dataClasses/hashcode/array.kt | 2 +- .../boxWithStdlib/enum/sortEnumEntries.kt | 2 +- .../codegen/boxWithStdlib/fullJdk/kt2423.kt | 8 +- .../codegen/boxWithStdlib/fullJdk/kt2509.kt | 2 +- .../fullJdk/regressions/collections.kt | 84 +++++++++---------- .../fullJdk/regressions/kt864.kt | 4 +- .../lazyCodegen/safeCallAndArray.kt | 2 +- .../reflection/kClassInAnnotation/array.kt | 2 +- .../propertyOfNestedClassAndArrayType.kt | 2 +- .../boxWithStdlib/regressions/Kt2495Test.kt | 2 +- .../regressions/getGenericInterfaces.kt | 2 +- .../boxWithStdlib/regressions/kt1800.kt | 2 +- .../boxWithStdlib/regressions/kt2210.kt | 2 +- .../boxWithStdlib/regressions/kt5056.kt | 2 +- .../boxWithStdlib/regressions/kt789.kt | 2 +- .../boxWithStdlib/reified/copyToArray.kt | 2 +- .../boxWithStdlib/reified/filterIsInstance.kt | 2 +- .../boxWithStdlib/reified/nestedReified.kt | 6 +- .../reified/nestedReifiedSignature.kt | 4 +- .../codegen/boxWithStdlib/reified/spreads.kt | 8 +- .../codegen/boxWithStdlib/reified/varargs.kt | 4 +- .../storeStackBeforeInline/primitiveMerge.kt | 2 +- .../boxWithStdlib/toArray/copyToArray.kt | 2 +- .../toArray/kt3177-copyToArray.kt | 2 +- .../toArray/returnCopyToArray.kt | 2 +- .../boxWithStdlib/vararg/varargInFunParam.kt | 36 ++++---- .../when/switchOptimizationDense.kt | 2 +- .../switchOptimizationMultipleConditions.kt | 2 +- .../when/switchOptimizationSparse.kt | 2 +- .../when/switchOptimizationStatement.kt | 4 +- .../when/switchOptimizationTypes.kt | 8 +- .../when/switchOptimizationUnordered.kt | 2 +- 36 files changed, 109 insertions(+), 109 deletions(-) diff --git a/compiler/testData/codegen/boxWithStdlib/dataClasses/doubleParam.kt b/compiler/testData/codegen/boxWithStdlib/dataClasses/doubleParam.kt index 3a97e7002a6..a9ac39e0f24 100644 --- a/compiler/testData/codegen/boxWithStdlib/dataClasses/doubleParam.kt +++ b/compiler/testData/codegen/boxWithStdlib/dataClasses/doubleParam.kt @@ -26,5 +26,5 @@ fun box(): String { if (A(-2.72) !in s) return "Fail: -2.72 not found" if (A(NAN) !in s) return "Fail: NaN not found" - return if (s.size == 5) "OK" else "Fail $s" + return if (s.size() == 5) "OK" else "Fail $s" } diff --git a/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/genericarray.kt b/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/genericarray.kt index 46a357ff9c2..1744aa1255d 100644 --- a/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/genericarray.kt +++ b/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/genericarray.kt @@ -1,6 +1,6 @@ data class A(val v: Array) fun box() : String { - if(A(array(0,1,2)) != A(array(0,1,2))) return "fail" + if(A(arrayOf(0,1,2)) != A(arrayOf(0,1,2))) return "fail" return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/intarray.kt b/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/intarray.kt index dea1d525996..ea2024b3367 100644 --- a/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/intarray.kt +++ b/compiler/testData/codegen/boxWithStdlib/dataClasses/equals/intarray.kt @@ -1,6 +1,6 @@ data class A(val v: IntArray) fun box() : String { - if(A(intArray(0,1,2)) != A(intArray(0,1,2))) return "fail" + if(A(intArrayOf(0,1,2)) != A(intArrayOf(0,1,2))) return "fail" return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/dataClasses/floatParam.kt b/compiler/testData/codegen/boxWithStdlib/dataClasses/floatParam.kt index 5335df49f67..c694dcaedf3 100644 --- a/compiler/testData/codegen/boxWithStdlib/dataClasses/floatParam.kt +++ b/compiler/testData/codegen/boxWithStdlib/dataClasses/floatParam.kt @@ -26,5 +26,5 @@ fun box(): String { if (A(-2.72f) !in s) return "Fail: -2.72 not found" if (A(NAN) !in s) return "Fail: NaN not found" - return if (s.size == 5) "OK" else "Fail $s" + return if (s.size() == 5) "OK" else "Fail $s" } diff --git a/compiler/testData/codegen/boxWithStdlib/dataClasses/hashcode/array.kt b/compiler/testData/codegen/boxWithStdlib/dataClasses/hashcode/array.kt index b9eceabe0ea..e59b542e10b 100644 --- a/compiler/testData/codegen/boxWithStdlib/dataClasses/hashcode/array.kt +++ b/compiler/testData/codegen/boxWithStdlib/dataClasses/hashcode/array.kt @@ -1,6 +1,6 @@ data class A(val a: IntArray, var b: Array) fun box() : String { - if( A(intArray(1,2,3),array("239")).hashCode() != 31*java.util.Arrays.hashCode(intArray(0,1,2)) + "239".hashCode()) "fail" + if( A(intArrayOf(1,2,3),arrayOf("239")).hashCode() != 31*java.util.Arrays.hashCode(intArrayOf(0,1,2)) + "239".hashCode()) "fail" return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/enum/sortEnumEntries.kt b/compiler/testData/codegen/boxWithStdlib/enum/sortEnumEntries.kt index 0074daf6cb3..37745e71984 100644 --- a/compiler/testData/codegen/boxWithStdlib/enum/sortEnumEntries.kt +++ b/compiler/testData/codegen/boxWithStdlib/enum/sortEnumEntries.kt @@ -9,7 +9,7 @@ enum class Game { } fun box(): String { - val a = array(LIZARD, SCISSORS, SPOCK, ROCK, PAPER) + val a = arrayOf(LIZARD, SCISSORS, SPOCK, ROCK, PAPER) a.sort() val str = a.joinToString(" ") return if (str == "ROCK PAPER SCISSORS LIZARD SPOCK") "OK" else "Fail: $str" diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt index 527e44aaa62..04b86c8f702 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt @@ -1,5 +1,5 @@ fun ok1(): Boolean { - val queue = linkedList(1, 2, 3) + val queue = linkedListOf(1, 2, 3) while (!queue.isEmpty()) { queue.poll() for (y in 1..3) { @@ -12,8 +12,8 @@ fun ok1(): Boolean { } fun ok2(): Boolean { - val queue = linkedList(1, 2, 3) - val array = array(1, 2, 3) + val queue = linkedListOf(1, 2, 3) + val array = arrayOf(1, 2, 3) while (!queue.isEmpty()) { queue.poll() for (y in array) { @@ -26,7 +26,7 @@ fun ok2(): Boolean { } fun ok3(): Boolean { - val queue = linkedList(1, 2, 3) + val queue = linkedListOf(1, 2, 3) while (!queue.isEmpty()) { queue.poll() var x = 0 diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2509.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2509.kt index 441580875c3..10529d6d497 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2509.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2509.kt @@ -4,7 +4,7 @@ fun box(): String { } class A: B() { - override var foo = array(12, 13) + override var foo = arrayOf(12, 13) } abstract class B { diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/collections.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/collections.kt index 3105a68465e..396472d74f9 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/collections.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/collections.kt @@ -36,18 +36,18 @@ fun testMutableCollectionIterator(c: MutableCollection, t: T) { assertEquals(0, c.size()) } fun testMutableCollectionAddAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayList(t1, t2)) - assertEquals(arrayList(t1, t2), c) + c.addAll(arrayListOf(t1, t2)) + assertEquals(arrayListOf(t1, t2), c) } fun testMutableCollectionRemoveAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayList(t1, t2)) - c.removeAll(arrayList(t1)) - assertEquals(arrayList(t2), c) + c.addAll(arrayListOf(t1, t2)) + c.removeAll(arrayListOf(t1)) + assertEquals(arrayListOf(t2), c) } fun testMutableCollectionRetainAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayList(t1, t2)) - c.retainAll(arrayList(t1)) - assertEquals(arrayList(t1), c) + c.addAll(arrayListOf(t1, t2)) + c.retainAll(arrayListOf(t1)) + assertEquals(arrayListOf(t1), c) } fun testMutableCollectionClear(c: MutableCollection) { c.clear() @@ -55,27 +55,27 @@ fun testMutableCollectionClear(c: MutableCollection) { } fun testCollection() { - testCollectionSize(arrayList()) - testCollectionIsEmpty(arrayList()) - testCollectionContains(arrayList(1)) - testCollectionIterator(arrayList(1)) - testCollectionContainsAll(arrayList("a", "b")) + testCollectionSize(arrayListOf()) + testCollectionIsEmpty(arrayListOf()) + testCollectionContains(arrayListOf(1)) + testCollectionIterator(arrayListOf(1)) + testCollectionContainsAll(arrayListOf("a", "b")) - testMutableCollectionAdd(arrayList(), "") - testMutableCollectionRemove(arrayList("a"), "a") - testMutableCollectionIterator(arrayList(), 1) - testMutableCollectionAddAll(arrayList(), 1, 2) - testMutableCollectionRemoveAll(arrayList(), 1, 2) - testMutableCollectionRetainAll(arrayList(), 1, 2) - testMutableCollectionClear(arrayList(1, 2)) + testMutableCollectionAdd(arrayListOf(), "") + testMutableCollectionRemove(arrayListOf("a"), "a") + testMutableCollectionIterator(arrayListOf(), 1) + testMutableCollectionAddAll(arrayListOf(), 1, 2) + testMutableCollectionRemoveAll(arrayListOf(), 1, 2) + testMutableCollectionRetainAll(arrayListOf(), 1, 2) + testMutableCollectionClear(arrayListOf(1, 2)) } fun testListGet(l: List, t: T) = assertEquals(t, l.get(0)) fun testListIndexOf(l: List, t: T) = assertEquals(0, l.indexOf(t)) fun testListIterator(l: List, t1 : T, t2 : T) { - val indexes = arrayList() - val result = arrayList() + val indexes = arrayListOf() + val result = arrayListOf() val it = l.listIterator() while (it.hasNext()) { indexes.add(it.nextIndex()) @@ -85,14 +85,14 @@ fun testListIterator(l: List, t1 : T, t2 : T) { indexes.add(it.previousIndex()) result.add(it.previous()) } - assertEquals(arrayList(0, 1, 1, 0), indexes) - assertEquals(arrayList(t1, t2, t2, t1), result) + assertEquals(arrayListOf(0, 1, 1, 0), indexes) + assertEquals(arrayListOf(t1, t2, t2, t1), result) } -fun testListSublist(l: List, t: T) = assertEquals(arrayList(t), l.subList(0, 1)) +fun testListSublist(l: List, t: T) = assertEquals(arrayListOf(t), l.subList(0, 1)) fun testMutableListSet(l: MutableList, t: T) { l.set(0, t) - assertEquals(arrayList(t), l) + assertEquals(arrayListOf(t), l) } fun testMutableListIterator(l: MutableList, t1: T, t2: T, t3: T) { val it = l.listIterator() @@ -100,22 +100,22 @@ fun testMutableListIterator(l: MutableList, t1: T, t2: T, t3: T) { it.next() it.add(t3) } - assertEquals(arrayList(t1, t3, t2, t3), l) + assertEquals(arrayListOf(t1, t3, t2, t3), l) } fun testList() { - testListGet(arrayList(1), 1) - testListIndexOf(arrayList(1), 1) - testListIterator(arrayList("a", "b"), "a", "b") - testListSublist(arrayList(1, 2), 1) + testListGet(arrayListOf(1), 1) + testListIndexOf(arrayListOf(1), 1) + testListIterator(arrayListOf("a", "b"), "a", "b") + testListSublist(arrayListOf(1, 2), 1) - testMutableListSet(arrayList(2), 4) - testMutableListIterator(arrayList(1, 2), 1, 2, 3) + testMutableListSet(arrayListOf(2), 4) + testMutableListIterator(arrayListOf(1, 2), 1, 2, 3) } fun testMapContainsKey(map: Map, k: K) = assertTrue(map.containsKey(k)) -fun testMapKeys(map: Map, k1: K, k2: K) = assertEqualCollections(hashSet(k1, k2), map.keySet()) -fun testMapValues(map: Map, v1: V, v2: V) = assertEqualCollections(hashSet(v1, v2), map.values()) +fun testMapKeys(map: Map, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keySet()) +fun testMapValues(map: Map, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values()) fun testMapEntrySet(map: Map, k : K, v: V) { for (entry in map.entrySet()) { assertEquals(k, entry.key) @@ -126,16 +126,16 @@ fun testMutableMapEntry(map: MutableMap, k1 : K, v: V) { for (entry in map.entrySet()) { entry.setValue(v) } - assertEquals(hashMap(k1 to v), map) + assertEquals(hashMapOf(k1 to v), map) } fun testMap() { - testMapContainsKey(hashMap(1 to 'a', 2 to 'b'), 2) - testMapKeys(hashMap(1 to 'a', 2 to 'b'), 1, 2) - testMapValues(hashMap(1 to 'a', 2 to 'b'), 'a', 'b') - testMapEntrySet(hashMap(1 to 'a'), 1, 'a') - testMutableMapEntry(hashMap(1 to 'a'), 1, 'b') + testMapContainsKey(hashMapOf(1 to 'a', 2 to 'b'), 2) + testMapKeys(hashMapOf(1 to 'a', 2 to 'b'), 1, 2) + testMapValues(hashMapOf(1 to 'a', 2 to 'b'), 'a', 'b') + testMapEntrySet(hashMapOf(1 to 'a'), 1, 'a') + testMutableMapEntry(hashMapOf(1 to 'a'), 1, 'b') } fun box() : String { @@ -145,4 +145,4 @@ fun box() : String { return "OK" } -fun assertEqualCollections(c1: Collection, c2: Collection) = assertEquals(c1.toCollection(hashSet()), c2.toCollection(hashSet())) +fun assertEqualCollections(c1: Collection, c2: Collection) = assertEquals(c1.toCollection(hashSetOf()), c2.toCollection(hashSetOf())) diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt index 3e6df2c25e3..b11c83cf342 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt @@ -13,7 +13,7 @@ World"""); val list1 = sample().useLines{it.toArrayList()} val list2 = sample().useLines>{it.toArrayList()} - if(arrayList("Hello", "World") != list1) return "fail" - if(arrayList("Hello", "World") != list2) return "fail" + if(arrayListOf("Hello", "World") != list1) return "fail" + if(arrayListOf("Hello", "World") != list2) return "fail" return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/lazyCodegen/safeCallAndArray.kt b/compiler/testData/codegen/boxWithStdlib/lazyCodegen/safeCallAndArray.kt index 9921ce6ac5e..90b61d66b5f 100644 --- a/compiler/testData/codegen/boxWithStdlib/lazyCodegen/safeCallAndArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/lazyCodegen/safeCallAndArray.kt @@ -6,6 +6,6 @@ class C { fun box(): String? { val c: C? = C() - val arrayList = array(c?.calc(), "") + val arrayList = arrayOf(c?.calc(), "") return arrayList[0] } diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt index 337479b18ef..16f0947107e 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt @@ -6,7 +6,7 @@ annotation class Ann(val args: Array>) class O class K -@Ann(array(O::class, K::class)) class MyClass +@Ann(arrayOf(O::class, K::class)) class MyClass fun box(): String { val args = javaClass().getAnnotation(javaClass()).args diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/properties/propertyOfNestedClassAndArrayType.kt b/compiler/testData/codegen/boxWithStdlib/reflection/properties/propertyOfNestedClassAndArrayType.kt index 87ce465fdc3..f35052f3eb0 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/properties/propertyOfNestedClassAndArrayType.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/properties/propertyOfNestedClassAndArrayType.kt @@ -8,7 +8,7 @@ class A { fun box(): String { val a = A() - (A::q).set(a, array(array(A.B("array")))) + (A::q).set(a, arrayOf(arrayOf(A.B("array")))) if (a.q!![0][0].result != "array") return "Fail array" (A::p).set(a, A.B("OK")) diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/Kt2495Test.kt b/compiler/testData/codegen/boxWithStdlib/regressions/Kt2495Test.kt index 0b7af7dc4d7..8a8dee2137a 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/Kt2495Test.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/Kt2495Test.kt @@ -9,7 +9,7 @@ fun f(xs: Iterator): Int { } fun box(): String { - val list = arrayList(1, 2, 3) + val list = arrayListOf(1, 2, 3) val result = f(list.iterator()) return if (6 == result) "OK" else "fail" } \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt b/compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt index 7bc013b60b7..1037ed73a05 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt @@ -11,7 +11,7 @@ class ClassWithGenericSuperInterface: java.util.Comparator { fun check(klass: Class<*>) { val interfaces = klass.getInterfaces().toList() val genericInterfaces = klass.getGenericInterfaces().toList() - if (interfaces.size != genericInterfaces.size) { + if (interfaces.size() != genericInterfaces.size()) { throw AssertionError("interfaces=$interfaces, genericInterfaces=$genericInterfaces") } } diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt1800.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt1800.kt index 5cb3630e394..94187405f67 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt1800.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt1800.kt @@ -20,7 +20,7 @@ public fun > Collection.testMin(): T? { } fun box() : String { - val users = arrayList( + val users = arrayListOf( User("John", "Doe", 30), User("Jane", "Doe", 27)) diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt2210.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt2210.kt index 1706319e1bd..95f4d64882a 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt2210.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt2210.kt @@ -3,6 +3,6 @@ class A(t: Array>) { } fun box(): String { - A(array()) // <- java.lang.VerifyError: (class: A, method: getA signature: ()[[Ljava/lang/Object;) Wrong return type in function + A(arrayOf()) // <- java.lang.VerifyError: (class: A, method: getA signature: ()[[Ljava/lang/Object;) Wrong return type in function return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt5056.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt5056.kt index 55ebf62d250..fb265c626d2 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt5056.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt5056.kt @@ -1,4 +1,4 @@ fun box(): String { - val list = array("a", "c", "b").toSortedList() + val list = arrayOf("a", "c", "b").sorted() return if (list.toString() == "[a, b, c]") "OK" else "Fail: $list" } diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt789.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt789.kt index 9ce0845893f..d2d9311acf9 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt789.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt789.kt @@ -8,5 +8,5 @@ fun box() : String { val a = ArrayList(); a.add(1) a.add(2) - return if((a.size == 2) && (a.get(1) == 2) && (a.get(0) == 1)) "OK" else "fail" + return if((a.size() == 2) && (a.get(1) == 2) && (a.get(0) == 1)) "OK" else "fail" } diff --git a/compiler/testData/codegen/boxWithStdlib/reified/copyToArray.kt b/compiler/testData/codegen/boxWithStdlib/reified/copyToArray.kt index a7eeae2b0c2..44df39435ba 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/copyToArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/copyToArray.kt @@ -1,7 +1,7 @@ import kotlin.test.assertEquals inline fun copy(c: Collection): Array { - return c.copyToArray() + return c.toTypedArray() } fun box(): String { diff --git a/compiler/testData/codegen/boxWithStdlib/reified/filterIsInstance.kt b/compiler/testData/codegen/boxWithStdlib/reified/filterIsInstance.kt index f7e2f9a5c45..6c80a55f698 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/filterIsInstance.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/filterIsInstance.kt @@ -5,7 +5,7 @@ inline fun Array.filterIsInstance(): List { } fun box(): String { - val src: Array = array(1,2,3.toDouble(), "abc", "cde") + val src: Array = arrayOf(1,2,3.toDouble(), "abc", "cde") assertEquals(arrayListOf(1,2), src.filterIsInstance()) assertEquals(arrayListOf(3.0), src.filterIsInstance()) diff --git a/compiler/testData/codegen/boxWithStdlib/reified/nestedReified.kt b/compiler/testData/codegen/boxWithStdlib/reified/nestedReified.kt index 6158a3bc72a..19957731e9a 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/nestedReified.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/nestedReified.kt @@ -2,7 +2,7 @@ import kotlin.test.assertEquals inline fun foo(): Array { val x = object { - inline fun bar(): Array = array( + inline fun bar(): Array = arrayOf( javaClass().getName(), javaClass().getName(), javaClass().getName() ) fun f1() = bar() @@ -16,7 +16,7 @@ inline fun foo(): Array { val x3 = x.f3() val x4 = x.f4() - return array( + return arrayOf( x1[0], x1[1], x1[2], x2[0], x2[1], x2[2], x3[0], x3[1], x3[2], @@ -27,7 +27,7 @@ inline fun foo(): Array { fun box(): String { val result = foo() - val expected = array( + val expected = arrayOf( "java.lang.Double", "java.lang.Integer", "java.lang.Integer", "java.lang.Integer", "java.lang.Double", "java.lang.Integer", "java.lang.Boolean", "java.lang.Double", "java.lang.Integer", diff --git a/compiler/testData/codegen/boxWithStdlib/reified/nestedReifiedSignature.kt b/compiler/testData/codegen/boxWithStdlib/reified/nestedReifiedSignature.kt index 9967b2e9d3a..04210636a3e 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/nestedReifiedSignature.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/nestedReifiedSignature.kt @@ -11,13 +11,13 @@ inline fun foo(): Array> { fun f4() = bar() } - return array(x.f1(), x.f2(), x.f3(), x.f4()) + return arrayOf(x.f1(), x.f2(), x.f3(), x.f4()) } fun box(): String { val result = foo() - val expected = array( + val expected = arrayOf( Triple("java.lang.Double", "java.lang.Integer", "java.lang.Integer"), Triple("java.lang.Integer", "java.lang.Double", "java.lang.Integer"), Triple("java.lang.Boolean", "java.lang.Double", "java.lang.Integer"), diff --git a/compiler/testData/codegen/boxWithStdlib/reified/spreads.kt b/compiler/testData/codegen/boxWithStdlib/reified/spreads.kt index 2642bf941e2..de8dd2dba51 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/spreads.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/spreads.kt @@ -5,19 +5,19 @@ fun foo(vararg a: T) = a.size() inline fun bar(a: Array, block: () -> T): Array { assertEquals(4, foo(*a, block(), block())) - return array(*a, block(), block()) + return arrayOf(*a, block(), block()) } -inline fun empty() = array() +inline fun empty() = arrayOf() fun box(): String { var i = 0 - val a: Array = bar(array("1", "2")) { i++; i.toString() } + val a: Array = bar(arrayOf("1", "2")) { i++; i.toString() } assertEquals("1234", a.join("")) i = 0 - val b: Array = bar(array(0, 1)) { i++ } + val b: Array = bar(arrayOf(0, 1)) { i++ } assertEquals("0123", b.map { it.toString() }.join("")) return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/reified/varargs.kt b/compiler/testData/codegen/boxWithStdlib/reified/varargs.kt index ddbad0bcb1e..eb6ee2816ba 100644 --- a/compiler/testData/codegen/boxWithStdlib/reified/varargs.kt +++ b/compiler/testData/codegen/boxWithStdlib/reified/varargs.kt @@ -5,10 +5,10 @@ fun foo(vararg a: T) = a.size() inline fun bar(block: () -> T): Array { assertEquals(2, foo(block(), block())) - return array(block(), block(), block()) + return arrayOf(block(), block(), block()) } -inline fun empty() = array() +inline fun empty() = arrayOf() fun box(): String { var i = 0 diff --git a/compiler/testData/codegen/boxWithStdlib/storeStackBeforeInline/primitiveMerge.kt b/compiler/testData/codegen/boxWithStdlib/storeStackBeforeInline/primitiveMerge.kt index 749ef9ea6f4..8044be982e2 100644 --- a/compiler/testData/codegen/boxWithStdlib/storeStackBeforeInline/primitiveMerge.kt +++ b/compiler/testData/codegen/boxWithStdlib/storeStackBeforeInline/primitiveMerge.kt @@ -9,7 +9,7 @@ inline fun foo() = "-" fun box(): String { val result1 = foobar1(if (1 == 1) true else bar(), foo(), "OK") - val result2 = foobar2(if (1 == 1) "true" else array("false"), foo(), "OK") + val result2 = foobar2(if (1 == 1) "true" else arrayOf("false"), foo(), "OK") assertEquals("true-OK", result1) assertEquals("true-OK", result2) return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/toArray/copyToArray.kt b/compiler/testData/codegen/boxWithStdlib/toArray/copyToArray.kt index 7b9c8724125..03fd6b08ea4 100644 --- a/compiler/testData/codegen/boxWithStdlib/toArray/copyToArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/toArray/copyToArray.kt @@ -1,7 +1,7 @@ import java.util.Arrays fun box(): String { - val array = Arrays.asList(2, 3, 9).copyToArray() + val array = Arrays.asList(2, 3, 9).toTypedArray() if (array !is Array) return array.javaClass.toString() val str = Arrays.toString(array) diff --git a/compiler/testData/codegen/boxWithStdlib/toArray/kt3177-copyToArray.kt b/compiler/testData/codegen/boxWithStdlib/toArray/kt3177-copyToArray.kt index 0b7ee4c99d3..c64f5d38573 100644 --- a/compiler/testData/codegen/boxWithStdlib/toArray/kt3177-copyToArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/toArray/kt3177-copyToArray.kt @@ -6,7 +6,7 @@ fun box(): String { list.add(Pair("Sample", "http://cyber.law.harvard.edu/rss/examples/rss2sample.xml")) list.add(Pair("Scripting", "http://static.scripting.com/rss.xml")) - val keys = list.map { it.first }.copyToArray() + val keys = list.map { it.first }.toTypedArray() val keysToString = Arrays.toString(keys) if (keysToString != "[Sample, Scripting]") return keysToString diff --git a/compiler/testData/codegen/boxWithStdlib/toArray/returnCopyToArray.kt b/compiler/testData/codegen/boxWithStdlib/toArray/returnCopyToArray.kt index 4061dd4bd9a..2f0a2871a30 100644 --- a/compiler/testData/codegen/boxWithStdlib/toArray/returnCopyToArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/toArray/returnCopyToArray.kt @@ -1,6 +1,6 @@ import java.util.Arrays -fun getCopyToArray(): Array = Arrays.asList(2, 3, 9).copyToArray() +fun getCopyToArray(): Array = Arrays.asList(2, 3, 9).toTypedArray() fun box(): String { val str = Arrays.toString(getCopyToArray()) diff --git a/compiler/testData/codegen/boxWithStdlib/vararg/varargInFunParam.kt b/compiler/testData/codegen/boxWithStdlib/vararg/varargInFunParam.kt index 90ae040fba8..4f5438618f2 100644 --- a/compiler/testData/codegen/boxWithStdlib/vararg/varargInFunParam.kt +++ b/compiler/testData/codegen/boxWithStdlib/vararg/varargInFunParam.kt @@ -3,43 +3,43 @@ fun box(): String { if (test1(1) != "1") return "fail 2" if (test1(1, 2) != "12") return "fail 3" - if (test1(*intArray()) != "") return "fail 4" - if (test1(*intArray(1)) != "1") return "fail 5" - if (test1(*intArray(1, 2)) != "12") return "fail 6" + if (test1(*intArrayOf()) != "") return "fail 4" + if (test1(*intArrayOf(1)) != "1") return "fail 5" + if (test1(*intArrayOf(1, 2)) != "12") return "fail 6" if (test1(p = 1) != "1") return "fail 7" - if (test1(p = *intArray()) != "") return "fail 8" - if (test1(p = *intArray(1)) != "1") return "fail 9" - if (test1(p = *intArray(1, 2)) != "12") return "fail 10" + if (test1(p = *intArrayOf()) != "") return "fail 8" + if (test1(p = *intArrayOf(1)) != "1") return "fail 9" + if (test1(p = *intArrayOf(1, 2)) != "12") return "fail 10" if (test2() != "") return "fail 11" if (test2("1") != "1") return "fail 12" if (test2("1", "2") != "12") return "fail 13" - if (test2(*array()) != "") return "fail 14" - if (test2(*array("1")) != "1") return "fail 15" - if (test2(*array("1", "2")) != "12") return "fail 16" + if (test2(*arrayOf()) != "") return "fail 14" + if (test2(*arrayOf("1")) != "1") return "fail 15" + if (test2(*arrayOf("1", "2")) != "12") return "fail 16" if (test2(p = "1") != "1") return "fail 17" - if (test2(p = *array()) != "") return "fail 18" - if (test2(p = *array("1")) != "1") return "fail 19" - if (test2(p = *array("1", "2")) != "12") return "fail 20" + if (test2(p = *arrayOf()) != "") return "fail 18" + if (test2(p = *arrayOf("1")) != "1") return "fail 19" + if (test2(p = *arrayOf("1", "2")) != "12") return "fail 20" if (test3() != "") return "fail 21" if (test3("1") != "1") return "fail 22" if (test3("1", "2") != "12") return "fail 23" - if (test3(*array()) != "") return "fail 24" - if (test3(*array("1")) != "1") return "fail 25" - if (test3(*array("1", "2")) != "12") return "fail 26" + if (test3(*arrayOf()) != "") return "fail 24" + if (test3(*arrayOf("1")) != "1") return "fail 25" + if (test3(*arrayOf("1", "2")) != "12") return "fail 26" if (test3(p = "1") != "1") return "fail 27" - if (test3(p = *array()) != "") return "fail 28" - if (test3(p = *array("1")) != "1") return "fail 29" - if (test3(p = *array("1", "2")) != "12") return "fail 30" + if (test3(p = *arrayOf()) != "") return "fail 28" + if (test3(p = *arrayOf("1")) != "1") return "fail 29" + if (test3(p = *arrayOf("1", "2")) != "12") return "fail 30" return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationDense.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationDense.kt index d9d70c34f45..2f1fc2ef4e2 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationDense.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationDense.kt @@ -17,7 +17,7 @@ fun dense(x: Int): Int { } fun box(): String { - var result = (-5..10).map(::dense).makeString() + var result = (-5..10).map(::dense).joinToString() if (result != "19, 9, 19, 19, 10, 11, 12, 19, 19, 13, 14, 15, 16, 17, 18, 19") return "dense:" + result return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationMultipleConditions.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationMultipleConditions.kt index a2702467f0a..b9d147cec47 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationMultipleConditions.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationMultipleConditions.kt @@ -8,7 +8,7 @@ fun foo(x: Int): Int { } fun box(): String { - var result = (0..10).map(::foo).makeString() + var result = (0..10).map(::foo).joinToString() if (result != "4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4") return result return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationSparse.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationSparse.kt index 246b6ab4cd2..9a05bff9e0f 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationSparse.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationSparse.kt @@ -10,7 +10,7 @@ fun sparse(x: Int): Int { } fun box(): String { - var result = (0..3).map(::sparse).makeString() + var result = (0..3).map(::sparse).joinToString() if (result != "4, 1, 2, 3") return "sparse:" + result return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationStatement.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationStatement.kt index db9d8e86902..a4249660d72 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationStatement.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationStatement.kt @@ -22,11 +22,11 @@ fun nonExhaustive(x: Int): Int { } fun box(): String { - var result = (0..3).map(::exhaustive).makeString() + var result = (0..3).map(::exhaustive).joinToString() if (result != "4, 1, 2, 3") return "exhaustive:" + result - result = (0..3).map(::nonExhaustive).makeString() + result = (0..3).map(::nonExhaustive).joinToString() if (result != "4, 1, 2, 3") return "non-exhaustive:" + result return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationTypes.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationTypes.kt index f3a6962466b..6def00d03dd 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationTypes.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationTypes.kt @@ -35,19 +35,19 @@ fun charFoo(x: Char): Int { } fun box(): String { - var result = (1..4).map(::intFoo).makeString() + var result = (1..4).map(::intFoo).joinToString() if (result != "5, 6, 7, 8") return "int:" + result - result = (1.toShort()..4.toShort()).map(::shortFoo).makeString() + result = (1.toShort()..4.toShort()).map(::shortFoo).joinToString() if (result != "5, 6, 7, 8") return "short:" + result - result = (1.toByte()..4.toByte()).map(::byteFoo).makeString() + result = (1.toByte()..4.toByte()).map(::byteFoo).joinToString() if (result != "5, 6, 7, 8") return "byte:" + result - result = ('a'..'d').map(::charFoo).makeString() + result = ('a'..'d').map(::charFoo).joinToString() if (result != "5, 6, 7, 8") return "int:" + result return "OK" diff --git a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationUnordered.kt b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationUnordered.kt index d15dd7c6a34..1c637c29fbb 100644 --- a/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationUnordered.kt +++ b/compiler/testData/codegen/boxWithStdlib/when/switchOptimizationUnordered.kt @@ -8,7 +8,7 @@ fun foo(x: Int): Int { } fun box(): String { - var result = (0..3).map(::foo).makeString() + var result = (0..3).map(::foo).joinToString() if (result != "8, 5, 6, 7") return "unordered:" + result return "OK"