diff --git a/compiler/testData/codegen/boxInline/smap/assertion.2.kt b/compiler/testData/codegen/boxInline/smap/assertion.2.kt index ee44d6ec9d1..4b7e300724c 100644 --- a/compiler/testData/codegen/boxInline/smap/assertion.2.kt +++ b/compiler/testData/codegen/boxInline/smap/assertion.2.kt @@ -13,7 +13,7 @@ public inline fun massert(value: Boolean, lazyMessage: () -> String) { public inline fun massert(value: Boolean, message: Any = "Assertion failed") { - if (ASSERTIONS_ENABLED) { + if (MASSERTIONS_ENABLED) { if (!value) { throw AssertionError(message) } diff --git a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt index 6738678651e..874c862d488 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt @@ -5,7 +5,7 @@ import kotlin.test.* fun box(): String { val c = J::class.constructors.single() assertFalse(c.isAccessible) - assertFailsWith(IllegalCallableAccessException::class.java) { c.call("") } + assertFailsWith(IllegalCallableAccessException::class) { c.call("") } c.isAccessible = true assertTrue(c.isAccessible) @@ -13,7 +13,7 @@ fun box(): String { val m = J::class.members.single { it.name == "getResult" } assertFalse(m.isAccessible) - assertFailsWith(IllegalCallableAccessException::class.java) { m.call(j)!! } + assertFailsWith(IllegalCallableAccessException::class) { m.call(j)!! } m.isAccessible = true return m.call(j) as String diff --git a/compiler/testData/codegen/boxWithStdlib/casts/asFunKBig.kt b/compiler/testData/codegen/boxWithStdlib/casts/asFunKBig.kt index 0821f40f7b6..4799c108a6a 100644 --- a/compiler/testData/codegen/boxWithStdlib/casts/asFunKBig.kt +++ b/compiler/testData/codegen/boxWithStdlib/casts/asFunKBig.kt @@ -32,7 +32,7 @@ val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, : ::fn20, ::fn21, ::fn22) inline fun asFailsWithCCE(operation: String, crossinline block: () -> Unit) { - assertFailsWith(ClassCastException::class.java, "$operation should throw an exception") { + assertFailsWith(ClassCastException::class, "$operation should throw an exception") { block() } } diff --git a/compiler/testData/codegen/boxWithStdlib/casts/reifiedAsFunKBig.kt b/compiler/testData/codegen/boxWithStdlib/casts/reifiedAsFunKBig.kt index ca137b1ed67..133e8063c88 100644 --- a/compiler/testData/codegen/boxWithStdlib/casts/reifiedAsFunKBig.kt +++ b/compiler/testData/codegen/boxWithStdlib/casts/reifiedAsFunKBig.kt @@ -36,7 +36,7 @@ inline fun reifiedAsSucceeds(x: Any, operation: String) { } inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { - assertFailsWith(ClassCastException::class.java, "$operation should throw an exception") { + assertFailsWith(ClassCastException::class, "$operation should throw an exception") { x as T } } diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt index 04b86c8f702..fcac4e1292f 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt @@ -1,5 +1,7 @@ +import java.util.LinkedList + fun ok1(): Boolean { - val queue = linkedListOf(1, 2, 3) + val queue = LinkedList(listOf(1, 2, 3)) while (!queue.isEmpty()) { queue.poll() for (y in 1..3) { @@ -12,7 +14,7 @@ fun ok1(): Boolean { } fun ok2(): Boolean { - val queue = linkedListOf(1, 2, 3) + val queue = LinkedList(listOf(1, 2, 3)) val array = arrayOf(1, 2, 3) while (!queue.isEmpty()) { queue.poll() @@ -26,7 +28,7 @@ fun ok2(): Boolean { } fun ok3(): Boolean { - val queue = linkedListOf(1, 2, 3) + val queue = LinkedList(listOf(1, 2, 3)) while (!queue.isEmpty()) { queue.poll() var x = 0 diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt index bc6f20f3374..d680691ee66 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt @@ -7,10 +7,12 @@ World"""); } fun box() : String { + // NOTE: Also tested in stdlib: LineIteratorTest.useLines + // TODO compiler error // both these expressions causes java.lang.NoClassDefFoundError: collections/CollectionPackage - val list1 = sample().useLines{it.toArrayList()} - val list2 = sample().useLines>{it.toArrayList()} + val list1 = sample().useLines { it.toList() } + val list2 = sample().useLines>{ it.toCollection(arrayListOf()) } if(arrayListOf("Hello", "World") != list1) return "fail" if(arrayListOf("Hello", "World") != list2) return "fail" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt b/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt index 3ffae681f83..d33a772da9e 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt @@ -24,7 +24,7 @@ fun box(): String { return "Fail: no Kotlin function found for static bridge for @JvmStatic method in companion object C::foo" assertEquals(3, k2.call(C, "ghi")) - assertFailsWith(NullPointerException::class.java) { k2.call(null, "")!! } + assertFailsWith(NullPointerException::class) { k2.call(null, "")!! } val j2 = k2.javaMethod assertEquals(j, j2) diff --git a/idea/testData/intentions/importMember/TopLevelFun.kt b/idea/testData/intentions/importMember/TopLevelFun.kt index 9f995950e81..7cc0f6d88fe 100644 --- a/idea/testData/intentions/importMember/TopLevelFun.kt +++ b/idea/testData/intentions/importMember/TopLevelFun.kt @@ -3,5 +3,5 @@ fun foo() { kotlin.test.assertFailsWith("", {}) - kotlin.test.assertFailsWith(RuntimeException::class.java, "", {}) + kotlin.test.assertFailsWith(RuntimeException::class, "", {}) } diff --git a/idea/testData/intentions/importMember/TopLevelFun.kt.after b/idea/testData/intentions/importMember/TopLevelFun.kt.after index 89c23d8d1c7..0d7deda6bda 100644 --- a/idea/testData/intentions/importMember/TopLevelFun.kt.after +++ b/idea/testData/intentions/importMember/TopLevelFun.kt.after @@ -5,5 +5,5 @@ import kotlin.test.assertFailsWith fun foo() { assertFailsWith("", {}) - assertFailsWith(RuntimeException::class.java, "", {}) + assertFailsWith(RuntimeException::class, "", {}) } diff --git a/idea/testData/intentions/removeForLoopIndices/inapplicableOverridenFunction.kt b/idea/testData/intentions/removeForLoopIndices/inapplicableOverridenFunction.kt index 1442ced4db1..ea114ec7840 100644 --- a/idea/testData/intentions/removeForLoopIndices/inapplicableOverridenFunction.kt +++ b/idea/testData/intentions/removeForLoopIndices/inapplicableOverridenFunction.kt @@ -1,7 +1,6 @@ // WITH_RUNTIME // IS_APPLICABLE: FALSE - -fun Int.withIndex(): List> = linkedListOf>() +fun Int.withIndex(): List> = listOf>() fun foo(s: Int) { for ((index, a) in s.withIndex()) { diff --git a/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt b/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt index 659f35cfecc..938f05a571e 100644 --- a/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt +++ b/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt @@ -2,5 +2,5 @@ package some fun testFun() { - measureTimeNano({}) + measureNanoTime({}) } diff --git a/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt.after b/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt.after index f72fb342033..688dd07233d 100644 --- a/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt.after +++ b/idea/testData/quickfix/autoImports/libraryTopLevelFunctionImportRuntime.kt.after @@ -1,8 +1,8 @@ // "Import" "true" package some -import kotlin.system.measureTimeNano +import kotlin.system.measureNanoTime fun testFun() { - measureTimeNano({}) + measureNanoTime({}) } diff --git a/js/js.translator/testData/expression/misc/cases/toGeneratorInStdlib.kt b/js/js.translator/testData/expression/misc/cases/toGeneratorInStdlib.kt index 6b55f4b6840..d620320d332 100644 --- a/js/js.translator/testData/expression/misc/cases/toGeneratorInStdlib.kt +++ b/js/js.translator/testData/expression/misc/cases/toGeneratorInStdlib.kt @@ -1,7 +1,7 @@ package foo fun sequenceFromFunctionWithInitialValue() { - val values = sequence(3) { n -> if (n > 0) n - 1 else null } + val values = generateSequence(3) { n -> if (n > 0) n - 1 else null } assertEquals(arrayListOf(3, 2, 1, 0), values.toList()) } diff --git a/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt b/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt index db9daec611a..76a3b24e237 100644 --- a/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt +++ b/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt @@ -1,10 +1,12 @@ package foo +import kotlin.comparisons.* + val Int.abs: Int get() = if (this >= 0) this else -this fun test(xs: List): List = - xs.sortedWith(comparator { a, b -> a.abs.compareTo(b.abs) }) + xs.sortedWith(compareBy { it.abs }) fun box(): String { assertEquals(listOf(1, -2, 3, -4), test(listOf(-2, 1, -4, 3))) diff --git a/js/js.translator/testData/webDemoExamples2/cases/life.kt b/js/js.translator/testData/webDemoExamples2/cases/life.kt index 646d1ea5ce0..26689d35cf7 100644 --- a/js/js.translator/testData/webDemoExamples2/cases/life.kt +++ b/js/js.translator/testData/webDemoExamples2/cases/life.kt @@ -123,7 +123,7 @@ fun printField(s: String, steps: Int) { fun makeField(s: String): Field { val lines: List = s.split("\n") - val w = Collections.max(lines.toList(), comparator { o1, o2 -> + val w = Collections.max(lines.toList(), Comparator { o1, o2 -> val l1: Int = o1.length val l2 = o2.length l1 - l2