FIR: perform more proper type approximation in completion

Note: test data change is questionable here
This commit is contained in:
Mikhail Glukhikh
2020-09-17 18:27:06 +03:00
parent 14cfc62745
commit 0310272738
2 changed files with 6 additions and 7 deletions
@@ -260,11 +260,10 @@ class FirCallCompletionResultsWriterTransformer(
candidate: Candidate,
): FirResolvedTypeRef {
val initialType = candidate.substitutor.substituteOrSelf(type)
val finalType = finalSubstitutor.substituteOrNull(initialType)?.let { substitutedType ->
typeApproximator.approximateToSuperType(
substitutedType, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference,
) as ConeKotlinType? ?: substitutedType
}
val substitutedType = finalSubstitutor.substituteOrNull(initialType)
val finalType = typeApproximator.approximateToSuperType(
type = substitutedType ?: initialType, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference,
) as ConeKotlinType? ?: substitutedType
return withReplacedConeType(finalType)
}
@@ -19,6 +19,6 @@ class In<in F> {
}
fun test() {
A.foo().x() checkType { _<Any?>() }
A.bar().<!INAPPLICABLE_CANDIDATE!>y<!>(null)
A.foo().<!UNRESOLVED_REFERENCE!>x<!>() <!INAPPLICABLE_CANDIDATE!>checkType<!> { _<Any?>() }
A.bar().<!UNRESOLVED_REFERENCE!>y<!>(null)
}