[FIR] KT-58674: Ensure loop conditions have no expected type in K2
This commit is contained in:
committed by
Space Team
parent
a50ae9db9d
commit
737c8c20f6
+6
@@ -1257,6 +1257,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("whileConditionExpectedType.kt")
|
||||||
|
public void testWhileConditionExpectedType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/whileConditionExpectedType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+6
@@ -1257,6 +1257,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("whileConditionExpectedType.kt")
|
||||||
|
public void testWhileConditionExpectedType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/whileConditionExpectedType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+6
@@ -1257,6 +1257,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("whileConditionExpectedType.kt")
|
||||||
|
public void testWhileConditionExpectedType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/whileConditionExpectedType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+6
@@ -1257,6 +1257,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("whileConditionExpectedType.kt")
|
||||||
|
public void testWhileConditionExpectedType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/whileConditionExpectedType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// ISSUE: KT-58674
|
||||||
|
// INFERENCE_HELPERS
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
while (<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()) { // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
} while (<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()) // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||||
|
|
||||||
|
if (materialize()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (val it = materialize<Boolean>()) {
|
||||||
|
materialize() -> {}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// ISSUE: KT-58674
|
||||||
|
// INFERENCE_HELPERS
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
while (materialize()) { // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
} while (materialize()) // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||||
|
|
||||||
|
if (materialize()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (val it = materialize<Boolean>()) {
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>() -> {}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+6
@@ -1257,6 +1257,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
runTest("compiler/testData/diagnostics/tests/Variance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("whileConditionExpectedType.kt")
|
||||||
|
public void testWhileConditionExpectedType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/whileConditionExpectedType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user