[NI] Fix resolution status for UnstableSmartCastDiagnostic
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
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// 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"
|
||||
}
|
||||
Reference in New Issue
Block a user