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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user