[K/N and WASM] Internalize NoWhenBranchMatchedException and UninitializedPropertyAccessException

As a part of efforts to stabilize Native stdlib.

Merge-request: KT-MR-9531
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
This commit is contained in:
Abduqodiri Qurbonzoda
2023-04-10 21:10:51 +00:00
committed by Space Team
parent 85450c93a6
commit b65a68ca0d
15 changed files with 34 additions and 6 deletions
@@ -20,13 +20,15 @@ class X {
// MODULE: mainLib(lib)
// FILE: mainLib.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
val x = X()
fun lib(): String {
val a = try {
qux
} catch (e: UninitializedPropertyAccessException) {
} catch (e: UninitializedPropertyAccessException) {
"uninitiaized"
}
@@ -2,6 +2,8 @@
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +InlineLateinit
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC1(val x: String)
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
fun box(): String {
lateinit var str: String
try {
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun runNoInline(f: () -> Unit) = f()
@@ -1,6 +1,8 @@
// WITH_STDLIB
// WASM_MUTE_REASON: REFLECTION
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun runNoInline(f: () -> Unit) = f()
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -1,6 +1,8 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -10,6 +10,8 @@ object C {
}
// FILE: test.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
lateinit var str: String
@@ -1,5 +1,7 @@
// WITH_STDLIB
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import kotlin.UninitializedPropertyAccessException
lateinit var str: String
+1 -1
View File
@@ -162,7 +162,7 @@ private class CustomThrowableFailure(private val checker: (Throwable) -> Boolean
TestFailedWithException(t) // Unexpected type of exception.
}
@Suppress("PrivatePropertyName")
@Suppress("PrivatePropertyName", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
private val NoWhenBranchFailure = CustomThrowableFailure { it is NoWhenBranchMatchedException }
private sealed class Test {
@@ -3,6 +3,8 @@
* that can be found in the LICENSE file.
*/
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import a.*
fun main() {
@@ -131,7 +131,8 @@ public actual open class AssertionError : Error {
constructor(message: String?, cause: Throwable?) : super(message, cause)
}
public actual open class NoWhenBranchMatchedException : RuntimeException {
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual open class NoWhenBranchMatchedException : RuntimeException {
actual constructor() : super()
@@ -142,7 +143,8 @@ public actual open class NoWhenBranchMatchedException : RuntimeException {
actual constructor(cause: Throwable?) : super(cause)
}
public actual open class UninitializedPropertyAccessException : RuntimeException {
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual open class UninitializedPropertyAccessException : RuntimeException {
actual constructor() : super()
@@ -95,14 +95,16 @@ public actual open class ArithmeticException : RuntimeException {
public actual constructor(message: String?) : super(message)
}
public actual open class NoWhenBranchMatchedException : RuntimeException {
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual open class NoWhenBranchMatchedException : RuntimeException {
public actual constructor() : super()
public actual constructor(message: String?) : super(message)
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
public actual constructor(cause: Throwable?) : super(cause)
}
public actual open class UninitializedPropertyAccessException : RuntimeException {
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual open class UninitializedPropertyAccessException : RuntimeException {
public actual constructor() : super()
public actual constructor(message: String?) : super(message)
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)