[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:
+7
-1
@@ -87,7 +87,13 @@ class KotlinToResolvedCallTransformer(
|
|||||||
val candidate = baseResolvedCall.resultCallAtom!!
|
val candidate = baseResolvedCall.resultCallAtom!!
|
||||||
when (baseResolvedCall.type) {
|
when (baseResolvedCall.type) {
|
||||||
CallResolutionResult.Type.PARTIAL -> {
|
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)
|
return createStubResolvedCallAndWriteItToTrace(candidate, context.trace)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user