Handle nested when with subject properly
Hack: callee expression for when with subject variable is the subject variable declaration. This solves the problem that all sub-calls in the expression are implicitly considered to have a single common lexical scope (and 'when (val x = ...)' introduces a new lexical scope, which contains 'x').
This commit is contained in:
@@ -22475,6 +22475,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/invisibleOutsideOfWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedWhenWithSubject.kt")
|
||||
public void testNestedWhenWithSubject() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/nestedWhenWithSubject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reassignmentToWhenSubjectVariable.kt")
|
||||
public void testReassignmentToWhenSubjectVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt");
|
||||
|
||||
Generated
+5
@@ -22475,6 +22475,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/invisibleOutsideOfWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedWhenWithSubject.kt")
|
||||
public void testNestedWhenWithSubject() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/nestedWhenWithSubject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reassignmentToWhenSubjectVariable.kt")
|
||||
public void testReassignmentToWhenSubjectVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt");
|
||||
|
||||
Reference in New Issue
Block a user