K2: add test for KT-57649
This commit is contained in:
committed by
Space Team
parent
0dbf218f0b
commit
2e69c643cb
+6
@@ -16377,6 +16377,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/covariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyIntersectionOnIf.kt")
|
||||
public void testEmptyIntersectionOnIf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/emptyIntersectionOnIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461.kt")
|
||||
public void testKt45461() throws Exception {
|
||||
|
||||
+6
@@ -16377,6 +16377,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/covariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyIntersectionOnIf.kt")
|
||||
public void testEmptyIntersectionOnIf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/emptyIntersectionOnIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461.kt")
|
||||
public void testKt45461() throws Exception {
|
||||
|
||||
+6
@@ -16377,6 +16377,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/covariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyIntersectionOnIf.kt")
|
||||
public void testEmptyIntersectionOnIf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/emptyIntersectionOnIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461.kt")
|
||||
public void testKt45461() throws Exception {
|
||||
|
||||
+6
@@ -16383,6 +16383,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/covariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyIntersectionOnIf.kt")
|
||||
public void testEmptyIntersectionOnIf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/emptyIntersectionOnIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461.kt")
|
||||
public void testKt45461() throws Exception {
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// ISSUE: KT-57649
|
||||
|
||||
open class A
|
||||
abstract class B {
|
||||
fun test(current: A): A? =
|
||||
// K2 reports empty intersection here due to the smart cast from A to B, where A & B aren't compatible
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING("K; B?, A?; multiple incompatible classes; : B, A")!>if (current === this) current else null<!>
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// ISSUE: KT-57649
|
||||
|
||||
open class A
|
||||
abstract class B {
|
||||
fun test(current: A): A? =
|
||||
// K2 reports empty intersection here due to the smart cast from A to B, where A & B aren't compatible
|
||||
if (current === this) current else null
|
||||
}
|
||||
Generated
+6
@@ -16383,6 +16383,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/covariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyIntersectionOnIf.kt")
|
||||
public void testEmptyIntersectionOnIf() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/emptyIntersectionOnIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461.kt")
|
||||
public void testKt45461() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user