KT-11679 Fixed exception at ResolvedCallImpl.getArgumentMapping()
#KT-11679 Fixed Also fixed EA-75913 EA-78908
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.recordDataFlowInfo
|
|||||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
||||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode
|
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
|
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode
|
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT
|
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT
|
||||||
@@ -38,10 +39,12 @@ import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
|||||||
import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache
|
import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl
|
import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCallImpl
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults.Code.CANDIDATES_WITH_WRONG_RECEIVER
|
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults.Code.CANDIDATES_WITH_WRONG_RECEIVER
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults.Code.NAME_NOT_FOUND
|
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults.Code.NAME_NOT_FOUND
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsUtil
|
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsUtil
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||||
@@ -246,6 +249,12 @@ class CallExpressionResolver(
|
|||||||
context.replaceTraceAndCache(temporaryForVariable))
|
context.replaceTraceAndCache(temporaryForVariable))
|
||||||
val qualifier = temporaryForVariable.trace.get(BindingContext.QUALIFIER, calleeExpression)
|
val qualifier = temporaryForVariable.trace.get(BindingContext.QUALIFIER, calleeExpression)
|
||||||
if (notNothing && (qualifier == null || qualifier !is PackageQualifier)) {
|
if (notNothing && (qualifier == null || qualifier !is PackageQualifier)) {
|
||||||
|
|
||||||
|
// mark property call as unsuccessful to avoid exceptions
|
||||||
|
callExpression.getResolvedCall(temporaryForVariable.trace.bindingContext).let {
|
||||||
|
(it as? ResolvedCallImpl)?.addStatus(ResolutionStatus.OTHER_ERROR)
|
||||||
|
}
|
||||||
|
|
||||||
temporaryForVariable.commit()
|
temporaryForVariable.commit()
|
||||||
context.trace.report(FUNCTION_EXPECTED.on(calleeExpression, calleeExpression,
|
context.trace.report(FUNCTION_EXPECTED.on(calleeExpression, calleeExpression,
|
||||||
type ?: ErrorUtils.createErrorType("")))
|
type ?: ErrorUtils.createErrorType("")))
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// ERROR: Expression 'f' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found
|
||||||
|
// IS_APPLICABLE: false
|
||||||
|
class Paren(val f: String) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nonSimple() {
|
||||||
|
Paren("").f(<caret>6)
|
||||||
|
}
|
||||||
@@ -295,6 +295,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt11679.kt")
|
||||||
|
public void testKt11679() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addNameToArgument/kt11679.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("notInsideIndices.kt")
|
@TestMetadata("notInsideIndices.kt")
|
||||||
public void testNotInsideIndices() throws Exception {
|
public void testNotInsideIndices() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addNameToArgument/notInsideIndices.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addNameToArgument/notInsideIndices.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user