From 54bbeae273db41fb5a494bf3ab924679e22e732f Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Thu, 6 Apr 2023 20:56:27 +0300 Subject: [PATCH] [K/N] Internalize TypeCastException As a part of efforts to stabilize Native stdlib. --- .../backend.native/tests/interop/objc/tests/kt35544.kt | 4 ++-- kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/kt35544.kt b/kotlin-native/backend.native/tests/interop/objc/tests/kt35544.kt index df789abcbb9..26ebc26d94f 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/kt35544.kt +++ b/kotlin-native/backend.native/tests/interop/objc/tests/kt35544.kt @@ -2,7 +2,7 @@ import kotlin.test.* import objcTests.* @Test fun testKT35544() { - val exception = assertFailsWith { + val exception = assertFailsWith { 123 as NSString } assertEquals("class kotlin.Int cannot be cast to class objcTests.NSString", exception.message) @@ -11,7 +11,7 @@ fun testKT35544() { val bundle35544: Any = NSBundle() @Test fun testKT35544runtime() { - val exception = assertFailsWith { + val exception = assertFailsWith { bundle35544 as NSString } assertEquals("class NSBundle cannot be cast to class objcTests.NSString", exception.message) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt index 678199c761c..08b8e6f9105 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt @@ -106,7 +106,8 @@ public actual open class ClassCastException : RuntimeException { actual constructor(message: String?) : super(message) } -public open class TypeCastException : ClassCastException { +@PublishedApi +internal open class TypeCastException : ClassCastException { constructor() : super()