2979c37001
RESOLVED_WITH_ERROR was initially added for reproducing OI behavior. The intention was to preserve resolution into unstable smart cast and to keep failing candidate. However, this idea was abandoned after OI behavior proved inconsistent in cases involving generics. This commit restores RUNTIME_ERROR status of UnstableSmartCastDiagnostic. ^KT-41357 Fixed
17 lines
310 B
Kotlin
Vendored
17 lines
310 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
|
|
open class Foo(val id: Int)
|
|
|
|
class CustomFoo : Foo(1)
|
|
|
|
fun test(): Boolean {
|
|
val fooList = listOf(CustomFoo(), Foo(2))
|
|
return fooList.first() is CustomFoo && fooList.last().id == 2 // ClassCastException
|
|
}
|
|
|
|
fun box(): String {
|
|
check(test())
|
|
return "OK"
|
|
}
|