FIR: Correct capturing for type-alias bases arguments

NB: The test data change at testData/diagnostics/tests/typealias/noApproximationInTypeAliasArgumentSubstitution.fir.kt
is correct: see the relevant non-fir test, the call shouldn't be applicable

^KT-39008 Fixed
This commit is contained in:
Denis Zharkov
2020-06-10 13:20:25 +03:00
parent bea37569e6
commit 293f78efe8
6 changed files with 41 additions and 2 deletions
@@ -241,7 +241,13 @@ private fun Candidate.captureTypeFromExpressionOrNull(argumentType: ConeKotlinTy
return captureTypeFromExpressionOrNull(argumentType.lowerBound)
}
if (argumentType.typeArguments.isEmpty() || argumentType !is ConeClassLikeType) return null
if (argumentType !is ConeClassLikeType) return null
argumentType.fullyExpandedType(bodyResolveComponents.session).let {
if (it !== argumentType) return captureTypeFromExpressionOrNull(it)
}
if (argumentType.typeArguments.isEmpty()) return null
return bodyResolveComponents.inferenceComponents.ctx.captureFromArguments(
argumentType, CaptureStatus.FROM_EXPRESSION