[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:
Generated
+5
@@ -28056,6 +28056,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt41357.kt")
|
||||
public void testKt41357() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt41357.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt4142.kt")
|
||||
public void testKt4142() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ object ErrorDescriptorDiagnostic : ResolutionDiagnostic(RESOLVED) // todo discus
|
||||
object LowPriorityDescriptorDiagnostic : ResolutionDiagnostic(RESOLVED_LOW_PRIORITY)
|
||||
object DynamicDescriptorDiagnostic : ResolutionDiagnostic(RESOLVED_LOW_PRIORITY)
|
||||
object ResolvedUsingNewFeatures : ResolutionDiagnostic(RESOLVED_NEED_PRESERVE_COMPATIBILITY)
|
||||
object UnstableSmartCastDiagnostic : ResolutionDiagnostic(RESOLVED_WITH_ERROR)
|
||||
object UnstableSmartCastDiagnostic : ResolutionDiagnostic(MAY_THROW_RUNTIME_ERROR)
|
||||
object HiddenExtensionRelatedToDynamicTypes : ResolutionDiagnostic(HIDDEN)
|
||||
object HiddenDescriptor : ResolutionDiagnostic(HIDDEN)
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
+5
@@ -29652,6 +29652,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt41357.kt")
|
||||
public void testKt41357() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt41357.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt4142.kt")
|
||||
public void testKt4142() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||
|
||||
+5
@@ -27286,6 +27286,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt41357.kt")
|
||||
public void testKt41357() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt41357.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt4142.kt")
|
||||
public void testKt4142() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||
|
||||
+5
@@ -28056,6 +28056,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt41357.kt")
|
||||
public void testKt41357() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt41357.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt4142.kt")
|
||||
public void testKt4142() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||
|
||||
Reference in New Issue
Block a user