analyze function arguments after completion for unresolved and ambiguity cases
This commit is contained in:
@@ -31,7 +31,6 @@ import org.jetbrains.jet.lang.resolve.calls.context.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallImpl;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallWithTrace;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.VariableAsFunctionResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResultsImpl;
|
||||
import org.jetbrains.jet.lang.resolve.calls.results.ResolutionDebugInfo;
|
||||
@@ -60,8 +59,8 @@ import static org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor.NO_
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.NON_DEFAULT_EXPRESSION_DATA_FLOW;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.RESOLUTION_SCOPE;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.RESOLVED_CALL;
|
||||
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
|
||||
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
|
||||
import static org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults.Code.*;
|
||||
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
|
||||
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||
@@ -324,6 +323,7 @@ public class CallResolver {
|
||||
results.getResultingCall().markCallAsCompleted();
|
||||
}
|
||||
else {
|
||||
argumentTypeResolver.checkTypesForFunctionArgumentsWithNoCallee(context);
|
||||
candidateResolver.completeNestedCallsForNotResolvedInvocation(context);
|
||||
}
|
||||
}
|
||||
@@ -475,7 +475,7 @@ public class CallResolver {
|
||||
}
|
||||
else {
|
||||
context.trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
|
||||
argumentTypeResolver.checkTypesWithNoCallee(context, RESOLVE_FUNCTION_ARGUMENTS);
|
||||
argumentTypeResolver.checkTypesWithNoCallee(context, SHAPE_FUNCTION_ARGUMENTS);
|
||||
}
|
||||
return resultsForFirstNonemptyCandidateSet != null ? resultsForFirstNonemptyCandidateSet : OverloadResolutionResultsImpl.<F>nameNotFound();
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
package d
|
||||
|
||||
fun bar() {
|
||||
val i: Int? = 42
|
||||
if (i != null) {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>doSmth1<!> {
|
||||
val x = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth1(f: ()->Unit) {}
|
||||
fun doSmth1(g: (Int)->Unit) {}
|
||||
@@ -0,0 +1,26 @@
|
||||
open class HtmlTag
|
||||
|
||||
trait NavigationBuilder {
|
||||
public var text: ((String) -> String)?
|
||||
~in_NB~var inNavigationBuilder: Int
|
||||
}
|
||||
|
||||
fun HtmlTag.navigation(body: NavigationBuilder.() -> Unit) {
|
||||
}
|
||||
fun HtmlTag.a(contents: A.() -> Unit) {
|
||||
}
|
||||
|
||||
trait A : HtmlTag {
|
||||
~text_in_A~var text: String
|
||||
~in_A~var inA: Int
|
||||
}
|
||||
|
||||
fun HtmlTag.test(a: String) {
|
||||
navigation {
|
||||
a {
|
||||
`text_in_A`text = "1"
|
||||
`in_NB`inNavigationBuilder = 1
|
||||
`in_A`inA = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4178,6 +4178,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/AssertNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("funcLiteralArgsInsideAmbiguity.kt")
|
||||
public void testFuncLiteralArgsInsideAmbiguity() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/funcLiteralArgsInsideAmbiguity.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("funcLiteralArgsInsideUnresolvedFunction.kt")
|
||||
public void testFuncLiteralArgsInsideUnresolvedFunction() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/funcLiteralArgsInsideUnresolvedFunction.kt");
|
||||
|
||||
@@ -117,6 +117,11 @@ public class JetResolveTestGenerated extends AbstractResolveTest {
|
||||
doTest("compiler/testData/resolve/Projections.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("PropertyAndFunctionNameClash.resolve")
|
||||
public void testPropertyAndFunctionNameClash() throws Exception {
|
||||
doTest("compiler/testData/resolve/PropertyAndFunctionNameClash.resolve");
|
||||
}
|
||||
|
||||
@TestMetadata("ResolveOfInfixExpressions.resolve")
|
||||
public void testResolveOfInfixExpressions() throws Exception {
|
||||
doTest("compiler/testData/resolve/ResolveOfInfixExpressions.resolve");
|
||||
|
||||
Reference in New Issue
Block a user