[FIR] Adding a test case to show resolution of KT-29559 in K2
This commit is contained in:
+12
@@ -1089,6 +1089,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/phantomIntersections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixIncSmartCast.kt")
|
||||
public void testPostfixIncSmartCast() {
|
||||
runTest("compiler/testData/diagnostics/tests/postfixIncSmartCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixIncReturnType.kt")
|
||||
public void testPrefixIncReturnType() {
|
||||
@@ -35518,6 +35524,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incrementAfterAssignment.kt")
|
||||
public void testIncrementAfterAssignment() {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incrementAfterAssignment.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10232.kt")
|
||||
public void testKt10232() {
|
||||
|
||||
+12
@@ -1089,6 +1089,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/phantomIntersections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixIncSmartCast.kt")
|
||||
public void testPostfixIncSmartCast() {
|
||||
runTest("compiler/testData/diagnostics/tests/postfixIncSmartCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixIncReturnType.kt")
|
||||
public void testPrefixIncReturnType() {
|
||||
@@ -35518,6 +35524,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incrementAfterAssignment.kt")
|
||||
public void testIncrementAfterAssignment() {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incrementAfterAssignment.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10232.kt")
|
||||
public void testKt10232() {
|
||||
|
||||
+12
@@ -1089,6 +1089,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/phantomIntersections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixIncSmartCast.kt")
|
||||
public void testPostfixIncSmartCast() {
|
||||
runTest("compiler/testData/diagnostics/tests/postfixIncSmartCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixIncReturnType.kt")
|
||||
public void testPrefixIncReturnType() {
|
||||
@@ -33090,6 +33096,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incrementAfterAssignment.kt")
|
||||
public void testIncrementAfterAssignment() {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incrementAfterAssignment.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10232.kt")
|
||||
public void testKt10232() {
|
||||
|
||||
+12
@@ -1089,6 +1089,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/phantomIntersections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixIncSmartCast.kt")
|
||||
public void testPostfixIncSmartCast() {
|
||||
runTest("compiler/testData/diagnostics/tests/postfixIncSmartCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixIncReturnType.kt")
|
||||
public void testPrefixIncReturnType() {
|
||||
@@ -33228,6 +33234,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incrementAfterAssignment.kt")
|
||||
public void testIncrementAfterAssignment() {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incrementAfterAssignment.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10232.kt")
|
||||
public void testKt10232() {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
open class I {
|
||||
operator fun inc(): ST = ST()
|
||||
}
|
||||
|
||||
class ST : I()
|
||||
|
||||
fun main() {
|
||||
var local = I()
|
||||
val x: ST = <!INITIALIZER_TYPE_MISMATCH!>local++<!>
|
||||
val y: ST = local
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
open class I {
|
||||
operator fun inc(): ST = ST()
|
||||
}
|
||||
|
||||
class ST : I()
|
||||
|
||||
fun main() {
|
||||
var local = I()
|
||||
val x: ST = <!TYPE_MISMATCH!>local++<!>
|
||||
val y: ST = <!TYPE_MISMATCH!>local<!>
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// WITH_STDLIB
|
||||
// SKIP_TEXT
|
||||
// ISSUE: KT-29559
|
||||
|
||||
fun consume(i: Int) {}
|
||||
fun consume(c: Char) {}
|
||||
fun consume(a: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
var a: Any
|
||||
|
||||
a = 1
|
||||
consume(a)
|
||||
|
||||
a = 1
|
||||
consume(a++)
|
||||
|
||||
a = 1
|
||||
consume(++a)
|
||||
|
||||
a = 't'
|
||||
consume(a++)
|
||||
|
||||
a = 't'
|
||||
consume(++a)
|
||||
consume(a++)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// WITH_STDLIB
|
||||
// SKIP_TEXT
|
||||
// ISSUE: KT-29559
|
||||
|
||||
fun consume(i: Int) {}
|
||||
fun consume(c: Char) {}
|
||||
fun consume(a: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
var a: Any
|
||||
|
||||
a = 1
|
||||
consume(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
|
||||
a = 1
|
||||
consume(<!TYPE_MISMATCH!><!DEBUG_INFO_SMARTCAST!>a<!>++<!>)
|
||||
|
||||
a = 1
|
||||
consume(++<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
|
||||
a = 't'
|
||||
consume(<!TYPE_MISMATCH!><!DEBUG_INFO_SMARTCAST!>a<!>++<!>)
|
||||
|
||||
a = 't'
|
||||
consume(++<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
consume(<!DEBUG_INFO_SMARTCAST!><!DEBUG_INFO_SMARTCAST!>a<!>++<!>)
|
||||
}
|
||||
Generated
+12
@@ -1089,6 +1089,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/phantomIntersections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("postfixIncSmartCast.kt")
|
||||
public void testPostfixIncSmartCast() {
|
||||
runTest("compiler/testData/diagnostics/tests/postfixIncSmartCast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("prefixIncReturnType.kt")
|
||||
public void testPrefixIncReturnType() {
|
||||
@@ -35518,6 +35524,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incrementAfterAssignment.kt")
|
||||
public void testIncrementAfterAssignment() {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/incrementAfterAssignment.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10232.kt")
|
||||
public void testKt10232() {
|
||||
|
||||
Reference in New Issue
Block a user