[FIR] Lambdas without contracts should be considered repeatable

^KT-63777 Fixed
This commit is contained in:
Brian Norman
2024-01-02 11:58:22 -06:00
committed by Space Team
parent 8a3f850bca
commit 3346cc4b19
4 changed files with 10 additions and 10 deletions
@@ -165,7 +165,7 @@ abstract class FirDataFlowAnalyzer(
}
localFunctionNode?.mergeIncomingFlow()
functionEnterNode.mergeIncomingFlow { _, flow ->
if (function is FirAnonymousFunction && function.invocationKind?.canBeRevisited() == true) {
if (function is FirAnonymousFunction && function.invocationKind?.canBeRevisited() != false) {
enterRepeatableStatement(flow, function)
}
}
@@ -176,7 +176,7 @@ abstract class FirDataFlowAnalyzer(
if (function is FirDefaultPropertyAccessor) return null
context.variableAssignmentAnalyzer.exitFunction()
if (function is FirAnonymousFunction && function.invocationKind?.canBeRevisited() == true) {
if (function is FirAnonymousFunction && function.invocationKind?.canBeRevisited() != false) {
exitRepeatableStatement(function)
}
@@ -27,7 +27,7 @@ fun test1() {
var x: Any? = materialize()
require(x is String)
runWithoutContract {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.<!UNRESOLVED_REFERENCE!>length<!>
x = 10
}
}
@@ -81,9 +81,9 @@ fun test7() {
var x: Any? = materialize()
require(x is String)
runWithoutContract {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.<!UNRESOLVED_REFERENCE!>length<!>
runWithoutContract {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.<!UNRESOLVED_REFERENCE!>length<!>
}
x = 10
}
@@ -498,7 +498,7 @@ fun test51() {
var x: Any = materialize()
while (x is String) {
runWithoutContract {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.<!UNRESOLVED_REFERENCE!>length<!>
x = 10
}
}
@@ -569,7 +569,7 @@ fun test58() {
for (i in 1..3) {
require(x is String)
runWithoutContract {
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.<!UNRESOLVED_REFERENCE!>length<!>
x = 10
}
}
@@ -370,7 +370,7 @@ fun test33() {
var y = x
runWithoutContract {
while (x is String) {
y.length
y.<!UNRESOLVED_REFERENCE!>length<!>
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
}
x = 10
@@ -30,7 +30,7 @@ fun baz(s: String?) {
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
}
run {
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
x<!UNSAFE_CALL!>.<!>hashCode()
x = null
}
}
@@ -40,7 +40,7 @@ fun gaz(s: String?) {
var x = s
if (x != null) {
run {
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
x<!UNSAFE_CALL!>.<!>hashCode()
x = null
}
run {