diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt index ba4f672e1d1..9cdeda19508 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt @@ -211,10 +211,9 @@ abstract class FirDataFlowAnalyzer( if (operandVariable.isReal()) { flow.addImplication((expressionVariable notEq null) implies (operandVariable typeEq type)) flow.addImplication((expressionVariable eq null) implies (operandVariable typeNotEq type)) - } else { - if (type.nullability == ConeNullability.NOT_NULL) { - flow.addImplication((expressionVariable notEq null) implies (operandVariable notEq null)) - } + } + if (type.nullability == ConeNullability.NOT_NULL) { + flow.addImplication((expressionVariable notEq null) implies (operandVariable notEq null)) } } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.kt b/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.kt index d6af94c9b02..f91f7422ce1 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.kt +++ b/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.kt @@ -40,7 +40,7 @@ fun test4(x: SomeClass?) { fun test5(x: AnotherClass?) { val bar = x?.bar as? String ?: return - x.foo + x.foo } fun test6(x: SomeClass?) { diff --git a/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.txt b/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.txt index e106c0a94ce..4f7f7606cb0 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/syntheticSmartCast.txt @@ -67,7 +67,7 @@ FILE: test.kt } } - R|/x|.# + R|/x|.R|/AnotherClass.foo| } public final fun test6(x: R|SomeClass?|): R|kotlin/Unit| { lval bar: R|kotlin/String| = when (lval : R|kotlin/String?| = (R|/x|?.R|/SomeClass.bar| as? R|kotlin/String|)) {