[Test] Reproduce KT-58823

This commit is contained in:
Dmitriy Novozhilov
2023-06-02 10:59:39 +03:00
committed by Space Team
parent 8b7cfcda10
commit c55ddab1bf
7 changed files with 58 additions and 0 deletions
@@ -49543,6 +49543,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@Test
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@Test
@TestMetadata("toStringOnReceiverWIthSmartcast.kt")
public void testToStringOnReceiverWIthSmartcast() throws Exception {
@@ -49543,6 +49543,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@Test
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@Test
@TestMetadata("toStringOnReceiverWIthSmartcast.kt")
public void testToStringOnReceiverWIthSmartcast() throws Exception {
@@ -0,0 +1,23 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_K2: JVM_IR
// ISSUE: KT-58823
// FILE: Base.java
public abstract class Base {}
// FILE: Derived.java
public class Derived extends Base {
<T> T getResult() {
return (T) "OK";
}
}
// FILE: main.kt
fun Base.box(): String {
return when (this) {
is Derived -> getResult()
else -> "Fail"
}
}
fun box(): String = Derived().box()
@@ -46843,6 +46843,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@Test
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@Test
@TestMetadata("whenSmartCast.kt")
public void testWhenSmartCast() throws Exception {
@@ -49543,6 +49543,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@Test
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@Test
@TestMetadata("toStringOnReceiverWIthSmartcast.kt")
public void testToStringOnReceiverWIthSmartcast() throws Exception {
@@ -49543,6 +49543,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@Test
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@Test
@TestMetadata("toStringOnReceiverWIthSmartcast.kt")
public void testToStringOnReceiverWIthSmartcast() throws Exception {
@@ -37986,6 +37986,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt");
}
@TestMetadata("smartcastOnImplicitDispatchReceiver.kt")
public void testSmartcastOnImplicitDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt");
}
@TestMetadata("whenSmartCast.kt")
public void testWhenSmartCast() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/whenSmartCast.kt");