From 18f9b20610216f754f9457fc46353fa0d434eaf9 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sun, 10 Feb 2019 19:23:46 +0300 Subject: [PATCH] Remove internal visibility suppressions in kotlin.test Internal visibility works fine in MPP, so they are no longer required. --- .../test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt | 1 - .../kotlin.test/js/src/main/kotlin/kotlin/test/JsImpl.kt | 1 - .../kotlin.test/jvm/src/main/kotlin/AssertionsImpl.kt | 8 +++----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/kotlin.test/common/src/test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt b/libraries/kotlin.test/common/src/test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt index e87331bc7ab..5d385fcc524 100644 --- a/libraries/kotlin.test/common/src/test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt +++ b/libraries/kotlin.test/common/src/test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt @@ -197,7 +197,6 @@ private fun checkFailedAssertion(assertion: () -> Unit) { assertFailsWith { withDefaultAsserter(assertion) } } -@Suppress("INVISIBLE_MEMBER") private fun withDefaultAsserter(block: () -> Unit) { val current = overrideAsserter(DefaultAsserter) try { diff --git a/libraries/kotlin.test/js/src/main/kotlin/kotlin/test/JsImpl.kt b/libraries/kotlin.test/js/src/main/kotlin/kotlin/test/JsImpl.kt index c807ee877aa..ba125245931 100644 --- a/libraries/kotlin.test/js/src/main/kotlin/kotlin/test/JsImpl.kt +++ b/libraries/kotlin.test/js/src/main/kotlin/kotlin/test/JsImpl.kt @@ -28,7 +28,6 @@ actual fun todo(block: () -> Unit) { */ actual fun assertFailsWith(exceptionClass: KClass, message: String?, block: () -> Unit): T { val exception = assertFails(message, block) - @Suppress("INVISIBLE_MEMBER") assertTrue(exceptionClass.isInstance(exception), messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $exception") @Suppress("UNCHECKED_CAST") diff --git a/libraries/kotlin.test/jvm/src/main/kotlin/AssertionsImpl.kt b/libraries/kotlin.test/jvm/src/main/kotlin/AssertionsImpl.kt index ee04a4f60c0..b26c969c04a 100644 --- a/libraries/kotlin.test/jvm/src/main/kotlin/AssertionsImpl.kt +++ b/libraries/kotlin.test/jvm/src/main/kotlin/AssertionsImpl.kt @@ -5,7 +5,6 @@ @file:kotlin.jvm.JvmMultifileClass @file:kotlin.jvm.JvmName("AssertionsKt") -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") package kotlin.test @@ -22,11 +21,9 @@ private fun assertFailsWithImpl(exceptionClass: Class, messag return e as T } - @Suppress("INVISIBLE_MEMBER") asserter.fail(messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $e") } - @Suppress("INVISIBLE_MEMBER") val msg = messagePrefix(message) asserter.fail(msg + "Expected an exception of $exceptionClass to be thrown, but was completed successfully.") } @@ -49,6 +46,7 @@ actual fun assertFailsWith(exceptionClass: KClass, message: S * * This keeps the code under test referenced, but doesn't actually test it until it is implemented. */ +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @InlineOnly actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) { println("TODO at " + currentStackTrace()[0]) @@ -59,7 +57,7 @@ actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) { * The first element of the array (assuming the array is not empty) represents the top of the * stack, which is the place where [currentStackTrace] function was called from. */ -@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @InlineOnly -inline fun currentStackTrace() = (java.lang.Exception() as java.lang.Throwable).stackTrace +inline fun currentStackTrace() = @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (java.lang.Exception() as java.lang.Throwable).stackTrace