diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt index e60dd61960a..6d2ea05c4b2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt @@ -124,6 +124,8 @@ class ConeEffectExtractor( val isNegated = when (val operation = equalityOperatorCall.operation) { FirOperation.EQ -> false FirOperation.NOT_EQ -> true + FirOperation.IDENTITY -> false + FirOperation.NOT_IDENTITY -> true else -> return ConeContractDescriptionError.IllegalEqualityOperator(operation).asElement() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/equalityAndIdentity.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/equalityAndIdentity.fir.kt index e166d1926e5..fe93b85d949 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/equalityAndIdentity.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/equalityAndIdentity.fir.kt @@ -5,7 +5,7 @@ import kotlin.contracts.* fun checkEquality(arg: E?) { contract { returns() implies (arg != null) } } -fun checkIdentity(arg: E?) { contract { returns() implies (arg !== null) } } +fun checkIdentity(arg: E?) { contract { returns() implies (arg !== null) } } fun checkTrue(statement: Boolean) { contract { returns() implies statement } } fun checkFalse(statement: Boolean) { contract { returns() implies !statement } } @@ -18,7 +18,7 @@ fun test(a: String?) { } a.let { checkIdentity(it) - consume(it) + consume(it) } a.let { checkTrue(it != null)