NI: don't do substitution for unsupported callable descriptors to use as callable references

^KT-41729 Fixed
This commit is contained in:
Victor Petukhov
2020-09-09 11:55:18 +03:00
parent 668098f3a8
commit 685d16ec68
27 changed files with 247 additions and 55 deletions
@@ -345,12 +345,11 @@ class ResolvedAtomCompleter(
(callableCandidate.candidate.typeParameters.map { it.typeConstructor } zip resultTypeParameters).toMap()
)
val firstSubstitution = typeParametersSubstitutor.toOldSubstitution()
val secondSubstitution = resultSubstitutor.toOldSubstitution()
val resultSubstitutor = TypeSubstitutor.createChainedSubstitutor(
firstSubstitution,
secondSubstitution
)
val resultSubstitutor = if (callableCandidate.candidate.isSupportedForCallableReference()) {
val firstSubstitution = typeParametersSubstitutor.toOldSubstitution()
val secondSubstitution = resultSubstitutor.toOldSubstitution()
TypeSubstitutor.createChainedSubstitutor(firstSubstitution, secondSubstitution)
} else TypeSubstitutor.EMPTY
val psiCallArgument = resolvedAtom.atom.psiCallArgument as CallableReferenceKotlinCallArgumentImpl
val callableReferenceExpression = psiCallArgument.ktCallableReferenceExpression