diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index d484f2dcde2..bd1de7dc5eb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -773,17 +773,23 @@ class NewResolvedCallImpl( } is FunctionDescriptor -> candidateDescriptor.substituteInferredVariablesAndApproximate(substitutor) is PropertyDescriptor -> { - val shouldForceApproximationAndSubstitution = candidateDescriptor.returnType?.let { type -> - type.contains { it is NewCapturedType } || - type.contains { it.constructor is IntegerLiteralTypeConstructor } || - type.contains { it is DefinitelyNotNullType } || - type.contains { it is StubType } - } ?: false - - if (candidateDescriptor.typeParameters.isNotEmpty() || shouldForceApproximationAndSubstitution) + if (candidateDescriptor.typeParameters.isNotEmpty()) candidateDescriptor.substituteInferredVariablesAndApproximate(substitutor) - else - candidateDescriptor + else { + val shouldForceApproximationAndSubstitution = candidateDescriptor.returnType?.let { type -> + type.contains { + it is NewCapturedType || + it.constructor is IntegerLiteralTypeConstructor || + it is DefinitelyNotNullType || + it is StubType + } + } ?: false + + if (shouldForceApproximationAndSubstitution) + candidateDescriptor.substituteInferredVariablesAndApproximate(substitutor) + else + candidateDescriptor + } } else -> candidateDescriptor }