Fixed: unmapped arguments should be completed as well.
This commit is contained in:
@@ -361,7 +361,7 @@ public class CallResolver {
|
||||
if (results.isSingleResult()) {
|
||||
Set<ValueArgument> unmappedArguments = results.getResultingCall().getCallToCompleteTypeArgumentInference().getUnmappedArguments();
|
||||
argumentTypeResolver.checkUnmappedArgumentTypes(context, unmappedArguments);
|
||||
candidateResolver.completeNestedCallsForNotResolvedInvocation(context, unmappedArguments);
|
||||
candidateResolver.completeUnmappedArguments(context, unmappedArguments);
|
||||
}
|
||||
|
||||
if (!results.isSingleResult()) return results;
|
||||
|
||||
@@ -334,6 +334,7 @@ public class CandidateResolver {
|
||||
completeInferenceForArgument(argument, parameterDescriptor, context);
|
||||
}
|
||||
}
|
||||
completeUnmappedArguments(context, context.candidateCall.getUnmappedArguments());
|
||||
recordReferenceForInvokeFunction(context);
|
||||
}
|
||||
|
||||
@@ -386,7 +387,11 @@ public class CandidateResolver {
|
||||
completeNestedCallsForNotResolvedInvocation(context, context.call.getValueArguments());
|
||||
}
|
||||
|
||||
public void completeNestedCallsForNotResolvedInvocation(@NotNull CallResolutionContext<?> context, @NotNull Collection<? extends ValueArgument> arguments) {
|
||||
public void completeUnmappedArguments(@NotNull CallResolutionContext<?> context, @NotNull Collection<? extends ValueArgument> unmappedArguments) {
|
||||
completeNestedCallsForNotResolvedInvocation(context, unmappedArguments);
|
||||
}
|
||||
|
||||
private void completeNestedCallsForNotResolvedInvocation(@NotNull CallResolutionContext<?> context, @NotNull Collection<? extends ValueArgument> arguments) {
|
||||
if (context.call.getCallType() == Call.CallType.INVOKE) return;
|
||||
if (context.checkArguments == CheckValueArgumentsMode.DISABLED) return;
|
||||
|
||||
@@ -400,7 +405,10 @@ public class CandidateResolver {
|
||||
context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
if (storedContextForArgument != null) {
|
||||
completeNestedCallsForNotResolvedInvocation(storedContextForArgument);
|
||||
argumentTypeResolver.checkTypesForFunctionArgumentsWithNoCallee(storedContextForArgument.replaceBindingTrace(context.trace));
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> newContext =
|
||||
storedContextForArgument.replaceBindingTrace(context.trace);
|
||||
completeUnmappedArguments(newContext, storedContextForArgument.candidateCall.getUnmappedArguments());
|
||||
argumentTypeResolver.checkTypesForFunctionArgumentsWithNoCallee(newContext.replaceContextDependency(INDEPENDENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package c
|
||||
|
||||
fun zzz(i: Int, f: (Int) -> Int) { throw Exception("$i $f")}
|
||||
|
||||
fun test() {
|
||||
fun foo(): Int = 42
|
||||
|
||||
fun bar(i: Int) = i
|
||||
|
||||
bar(foo(<!NAMED_PARAMETER_NOT_FOUND!>xx<!> = zzz(11) { (j: Int) -> j + 7 }))
|
||||
|
||||
bar(<!NAMED_PARAMETER_NOT_FOUND!>zz<!> = foo(
|
||||
<!NAMED_PARAMETER_NOT_FOUND!>xx<!> = zzz(12) { (i: Int) -> i + i })<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
@@ -5388,6 +5388,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/nestedCalls/analyzeArgsInFreeExpressionPosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("completeUnmappedArguments.kt")
|
||||
public void testCompleteUnmappedArguments() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/specialConstructions")
|
||||
|
||||
Reference in New Issue
Block a user