FIR DFA: check for reassignments of LHS when handling ?..

`x?.y != null` does not imply that `x != null` if e.g. an argument to
`y` has reassigned `x` in the meantime.

The same is true for `x == y` and `functionWithContract(x, y)`, but
those are somewhat harder to implement since there is no easy way to
find the last node of a certain argument.

^KT-55096
This commit is contained in:
pyos
2022-11-14 20:45:18 +01:00
committed by teamcity
parent ae1048f8a9
commit 5cc08fb314
11 changed files with 164 additions and 22 deletions
@@ -30643,6 +30643,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedDependency.kt");
}
@Test
@TestMetadata("reassignedInRhs.kt")
public void testReassignedInRhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedInRhs.kt");
}
@Test
@TestMetadata("varAsUse.kt")
public void testVarAsUse() throws Exception {