NI: Fix type mismatch caused by smartcast

^KT-25434 Fixed
This commit is contained in:
Denis Zharkov
2019-12-25 16:41:17 +03:00
parent ae4397fbfb
commit 7898922066
6 changed files with 102 additions and 3 deletions
@@ -269,8 +269,6 @@ object AbstractTypeChecker {
1 -> return isSubtypeForSameConstructor(supertypesWithSameConstructor.first().asArgumentList(), superType)
else -> { // at least 2 supertypes with same constructors. Such case is rare
if (supertypesWithSameConstructor.any { isSubtypeForSameConstructor(it.asArgumentList(), superType) }) return true
val newArguments = ArgumentList(superConstructor.parametersCount())
for (index in 0 until superConstructor.parametersCount()) {
val allProjections = supertypesWithSameConstructor.map {
@@ -283,7 +281,9 @@ object AbstractTypeChecker {
newArguments.add(intersection)
}
return isSubtypeForSameConstructor(newArguments, superType)
if (isSubtypeForSameConstructor(newArguments, superType)) return true
return supertypesWithSameConstructor.any { isSubtypeForSameConstructor(it.asArgumentList(), superType) }
}
}
}