From df230d36c226037e15b97e0210277a8fdea04c73 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 20 Mar 2013 17:18:10 +0400 Subject: [PATCH] complete nested calls for array set expression correctly --- .../jet/lang/resolve/calls/CandidateResolver.java | 2 +- .../completeNestedCallsForArraySetExpression.kt | 8 ++++++++ .../jet/checkers/JetDiagnosticsTestGenerated.java | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index 0af3abff508..e9eb7d6d451 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -313,7 +313,7 @@ public class CandidateResolver { if (callExpression == null) continue; CallCandidateResolutionContext storedContextForArgument = - context.resolutionResultsCache.getDeferredComputation(CallKey.create(context.call.getCallType(), callExpression)); + context.resolutionResultsCache.getDeferredComputation(CallKey.create(Call.CallType.DEFAULT, callExpression)); if (storedContextForArgument == null) continue; CallCandidateResolutionContext contextForArgument = diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt new file mode 100644 index 00000000000..147e8856741 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt @@ -0,0 +1,8 @@ +fun foo(t: T) = t + +fun test(map: MutableMap, t: Int) { + map [t] = foo(t) // t was marked with black square +} + +//from library +fun MutableMap.set(key : K, value : V) : V? = this.put(key, value) \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index f1cebbcf5bc..958c16c1446 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -2160,6 +2160,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/inference/nestedCalls"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("completeNestedCallsForArraySetExpression.kt") + public void testCompleteNestedCallsForArraySetExpression() throws Exception { + doTest("compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt"); + } + @TestMetadata("completeNestedCallsInference.kt") public void testCompleteNestedCallsInference() throws Exception { doTest("compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsInference.kt");