FIR DFA: x !is T? => x != null

^KT-22996 tag fixed-in-k2
This commit is contained in:
pyos
2022-11-14 17:18:01 +01:00
committed by teamcity
parent 02fedeb9ed
commit f485413cfd
18 changed files with 118 additions and 53 deletions
@@ -45,9 +45,11 @@ fun <F : Flow> LogicSystem<F>.approveContractStatement(
substitutedType.isAny -> it.processEqNull(!isType)
substitutedType.isNullableNothing -> it.processEqNull(isType)
else -> {
// x is (T & Any) => x != null
// TODO? (KT-22996) x !is T? => x != null: change `&&` to `==`
val fromNullability = if (isType && !type.canBeNull) it.processEqNull(false) else mapOf()
// x is (T & Any) || x !is T? => x != null
val fromNullability = if ((isType && !type.canBeNull) || (!isType && type.isMarkedNullable))
it.processEqNull(false)
else
mapOf()
if (isType && it is RealVariable) {
andForTypeStatements(fromNullability, mapOf(it to (it typeEq substitutedType)))
} else {