Fix KT-26478: Objective-C-objects-class-name-is-null-in-ClassCastExceptions-message

#KT-26478 Fixed

Merge-request: KT-MR-6405
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2022-06-09 12:57:11 +00:00
committed by Space
parent a31d383b4d
commit 83d7524232
7 changed files with 144 additions and 5 deletions
@@ -0,0 +1,21 @@
import kotlin.test.*
import objcTests.*
class KT26478
@Test
fun testKT26478compiletime() {
val exception = assertFailsWith<ClassCastException> {
NSBundle() as KT26478
}
assertEquals("class NSBundle cannot be cast to class KT26478", exception.message)
}
val bundle26478:Any = NSBundle()
@Test
fun testKT26478runtime() {
val exception = assertFailsWith<ClassCastException> {
bundle26478 as KT26478
}
assertEquals("class NSBundle cannot be cast to class KT26478", exception.message)
}
@@ -7,3 +7,12 @@ fun testKT35544() {
}
assertEquals("class kotlin.Int cannot be cast to class objcTests.NSString", exception.message)
}
val bundle35544: Any = NSBundle()
@Test
fun testKT35544runtime() {
val exception = assertFailsWith<TypeCastException> {
bundle35544 as NSString
}
assertEquals("class NSBundle cannot be cast to class objcTests.NSString", exception.message)
}