FIR: fix some errors in local variable assignment analyzer

* wrong method was called from FirDataFlowAnalyzer.exitFunctionCall;
 * map from function to affected properties should be keyed by symbol,
   not FirFunction, as the latter may change;
 * arguments of `return` and assignment statements should be visited,
   as they may contain lambdas.
This commit is contained in:
pyos
2022-06-09 15:09:02 +02:00
committed by Dmitriy Novozhilov
parent 9968fa252a
commit 526e46cffc
7 changed files with 43 additions and 121 deletions
@@ -1,69 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT
/*
* TESTCASE NUMBER: 1
* ISSUES: KT-30826
*/
fun case_1(x: Interface1?) {
var y = x
y as Interface2
val foo = {
<!DEBUG_INFO_EXPRESSION_TYPE("Interface1? & Interface1 & Interface2")!>y<!>.itest2()
}
y = null
foo()
}
/*
* TESTCASE NUMBER: 2
* ISSUES: KT-30826
*/
fun case_2(x: Interface1?) {
var y = x
y as Interface2
val foo = fun () {
<!DEBUG_INFO_EXPRESSION_TYPE("Interface1? & Interface1 & Interface2")!>y<!>.itest2()
}
y = null
foo()
}
/*
* TESTCASE NUMBER: 3
* ISSUES: KT-30826
*/
fun case_3(x: Interface1?) {
var y = x
y as Interface2
fun foo() {
<!DEBUG_INFO_EXPRESSION_TYPE("Interface1?"), SMARTCAST_IMPOSSIBLE!>y<!>.itest2()
}
y = null
foo()
}
// TESTCASE NUMBER: 4
fun case_4(x: Interface1?) {
var y = x
y as Interface2
y = null
fun foo() {
<!DEBUG_INFO_EXPRESSION_TYPE("Interface1?")!>y<!>.<!UNRESOLVED_REFERENCE!>itest2<!>()
}
y = x
foo()
}
// TESTCASE NUMBER: 5
fun case_5(x: Interface1?) {
var y = x
y as Interface2
y = null
fun foo() {
<!DEBUG_INFO_EXPRESSION_TYPE("Interface1?")!>y<!>.<!UNRESOLVED_REFERENCE!>itest2<!>()
}
y = x
foo()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT