[NI] Add collecting forgotten type variables from callable references

#KT-35959 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-01-23 11:27:37 +03:00
parent be74e92c27
commit 14cf7a3d16
7 changed files with 55 additions and 1 deletions
@@ -241,7 +241,10 @@ class KotlinConstraintSystemCompleter(
fun ResolvedAtom.process(to: LinkedHashSet<TypeConstructor>) {
val typeVariables = when (this) {
is ResolvedCallAtom -> freshVariablesSubstitutor.freshVariables
is CallableReferenceWithTypeVariableAsExpectedTypeAtom -> listOfNotNull(typeVariableForReturnType)
is CallableReferenceWithTypeVariableAsExpectedTypeAtom -> mutableListOf<NewTypeVariable>().apply {
addIfNotNull(typeVariableForReturnType)
addAll(candidate?.freshSubstitutor?.freshVariables.orEmpty())
}
is ResolvedCallableReferenceAtom -> candidate?.freshSubstitutor?.freshVariables.orEmpty()
is ResolvedLambdaAtom -> listOfNotNull(typeVariableForLambdaReturnType)
else -> emptyList()