[NI] Correctly propagate base constraint system of invoke call

Consider the following example:

class A {
  operator fun <T> invoke(): Foo<T> = throw Exception()
}

fun foo(f: Foo<Int>) {}

fun test(a: A) {
  foo(a()) // after resolve of `invoke`, it has non-fixed type variable
}
This commit is contained in:
Mikhail Zarechenskiy
2017-10-26 18:38:39 +03:00
parent 28e539b158
commit 4ad885afb0
@@ -87,7 +87,13 @@ class KotlinToResolvedCallTransformer(
val candidate = baseResolvedCall.resultCallAtom!!
when (baseResolvedCall.type) {
CallResolutionResult.Type.PARTIAL -> {
context.trace.record(BindingContext.ONLY_RESOLVED_CALL, candidate.atom.psiKotlinCall.psiCall, baseResolvedCall)
val psiKotlinCall = candidate.atom.psiKotlinCall
val psiCall = if (psiKotlinCall is PSIKotlinCallForInvoke)
psiKotlinCall.baseCall.psiCall
else
psiKotlinCall.psiCall
context.trace.record(BindingContext.ONLY_RESOLVED_CALL, psiCall, baseResolvedCall)
return createStubResolvedCallAndWriteItToTrace(candidate, context.trace)
}