K2: reproduce KT-59748
This commit is contained in:
committed by
Space Team
parent
a428ab6ed6
commit
1832413a02
+6
@@ -36627,6 +36627,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("listAssignmentInWhen.kt")
|
||||
public void testListAssignmentInWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/listAssignmentInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outstar.kt")
|
||||
public void testOutstar() throws Exception {
|
||||
|
||||
+6
@@ -36627,6 +36627,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("listAssignmentInWhen.kt")
|
||||
public void testListAssignmentInWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/listAssignmentInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outstar.kt")
|
||||
public void testOutstar() throws Exception {
|
||||
|
||||
+6
@@ -36627,6 +36627,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("listAssignmentInWhen.kt")
|
||||
public void testListAssignmentInWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/listAssignmentInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outstar.kt")
|
||||
public void testOutstar() throws Exception {
|
||||
|
||||
+6
@@ -36741,6 +36741,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("listAssignmentInWhen.kt")
|
||||
public void testListAssignmentInWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/listAssignmentInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outstar.kt")
|
||||
public void testOutstar() throws Exception {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// ISSUE: KT-59748
|
||||
// FIR_DUMP
|
||||
|
||||
fun foo(list: MutableList<Any?>, condition: Boolean): Unit = <!RETURN_TYPE_MISMATCH!>when {
|
||||
condition -> list[0] = ""
|
||||
else -> Unit
|
||||
}<!>
|
||||
|
||||
fun bar(list: MutableList<Any?>, condition: Boolean): Unit = <!RETURN_TYPE_MISMATCH!>when {
|
||||
condition -> list.set(0, "")
|
||||
else -> Unit
|
||||
}<!>
|
||||
@@ -0,0 +1,23 @@
|
||||
FILE: listAssignmentInWhen.fir.kt
|
||||
public final fun foo(list: R|kotlin/collections/MutableList<kotlin/Any?>|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^foo when () {
|
||||
R|<local>/condition| -> {
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.set: R|kotlin/Any?|>|(Int(0), String())
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun bar(list: R|kotlin/collections/MutableList<kotlin/Any?>|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^bar when () {
|
||||
R|<local>/condition| -> {
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.set: R|kotlin/Any?|>|(Int(0), String())
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// ISSUE: KT-59748
|
||||
// FIR_DUMP
|
||||
|
||||
fun foo(list: MutableList<Any?>, condition: Boolean): Unit = when {
|
||||
condition -> list[0] = ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
fun bar(list: MutableList<Any?>, condition: Boolean): Unit = <!TYPE_MISMATCH!>when {
|
||||
condition -> list.set(0, "")
|
||||
else -> Unit
|
||||
}<!>
|
||||
Generated
+6
@@ -37745,6 +37745,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("listAssignmentInWhen.kt")
|
||||
public void testListAssignmentInWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/listAssignmentInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outstar.kt")
|
||||
public void testOutstar() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user