[NI] Remove deep types in commosn super type for recursive types

#KT-30411 Fixed
This commit is contained in:
Dmitriy Novozhilov
2019-05-17 15:14:31 +03:00
parent f54653eb2b
commit b323298b0e
8 changed files with 95 additions and 49 deletions
@@ -212,7 +212,14 @@ object NewCommonSuperTypeCalculator {
if (thereIsStar || typeProjections.isEmpty()) {
createStarProjection(parameter)
} else {
calculateArgument(parameter, typeProjections, depth)
val argument = calculateArgument(parameter, typeProjections, depth)
val argumentType = argument.getType().asSimpleType()
val argumentConstructor = argumentType?.typeConstructor()
if (argument.getVariance() == TypeVariance.OUT && argumentConstructor == constructor && argumentType.asArgumentList()[index].isStarProjection()) {
createStarProjection(parameter)
} else {
argument
}
}
arguments.add(argument)