Add test for VAL_REASSIGNMENT on when subject variable
This commit is contained in:
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VALUE
|
||||
|
||||
fun foo(): Any = 42
|
||||
|
||||
fun test(x: Any) {
|
||||
when (val y = foo()) {
|
||||
is String -> <!VAL_REASSIGNMENT!>y<!> = ""
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun foo(): kotlin.Any
|
||||
public fun test(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
@@ -22472,6 +22472,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reassignmentToWhenSubjectVariable.kt")
|
||||
public void testReassignmentToWhenSubjectVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("shadowingOtherVariable.kt")
|
||||
public void testShadowingOtherVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/withSubjectVariable/shadowingOtherVariable.kt");
|
||||
|
||||
Generated
+6
@@ -22472,6 +22472,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reassignmentToWhenSubjectVariable.kt")
|
||||
public void testReassignmentToWhenSubjectVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("shadowingOtherVariable.kt")
|
||||
public void testShadowingOtherVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/withSubjectVariable/shadowingOtherVariable.kt");
|
||||
|
||||
Reference in New Issue
Block a user