[FIR] Lambdas without contracts should be considered repeatable
^KT-63777 Fixed
This commit is contained in:
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
-5
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
Vendored
+2
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user