[NI] Consider type non-nullable only if it has non-null supertype

Fixes #KT-12684 for NI
This commit is contained in:
Mikhail Zarechenskiy
2018-10-23 17:00:25 +03:00
parent 20ff74a726
commit 021732f74a
5 changed files with 27 additions and 1 deletions
@@ -250,7 +250,14 @@ internal class DataFlowInfoImpl private constructor(
if (!value.type.isFlexible() && value.type.isSubtypeOf(type)) return this
val nullabilityInfo = hashMapOf<DataFlowValue, Nullability>()
if (!type.isMarkedNullable) {
val isTypeNotNull =
if (languageVersionSettings.supportsFeature(LanguageFeature.NewInference))
!TypeUtils.isNullableType(type)
else
!type.isMarkedNullable
if (isTypeNotNull) {
putNullabilityAndTypeInfo(nullabilityInfo, value, NOT_NULL, languageVersionSettings)
}