From 808cf750601e0aaa870a0ad86f6c9f3c0ce169fe Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Mon, 28 Apr 2014 08:56:53 +0400 Subject: [PATCH] Fixed bug: resolution task wasn't recreated The old resolved calls were used --- .../jetbrains/jet/lang/resolve/calls/CallResolver.java | 3 ++- .../tests/resolve/incompleteConstructorInvocation.kt | 10 ++++++++++ .../jet/checkers/JetDiagnosticsTestGenerated.java | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index 1902e51b76f..55ed3959d69 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -564,7 +564,8 @@ public class CallResolver { }; TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(task.trace, "trace for resolution guarded for extra function literal arguments"); - ResolutionTask newTask = task.replaceBindingTrace(temporaryTrace).replaceCall(callWithoutFLArgs); + ResolutionTask newTask = new ResolutionTask(task.getCandidates(), task.toBasic(), task.tracing). + replaceBindingTrace(temporaryTrace).replaceCall(callWithoutFLArgs); OverloadResolutionResultsImpl resultsWithFunctionLiteralsStripped = performResolution(newTask, callTransformer); if (resultsWithFunctionLiteralsStripped.isSuccess() || resultsWithFunctionLiteralsStripped.isAmbiguity()) { diff --git a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt new file mode 100644 index 00000000000..7e846d55861 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt @@ -0,0 +1,10 @@ +package p + +class X(provider: () -> V, trackValue: Boolean) { +} + +class B { + val c = X { + "e" + } +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 589e5dcd418..09f60aa01c8 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -6131,6 +6131,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/resolve"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("incompleteConstructorInvocation.kt") + public void testIncompleteConstructorInvocation() throws Exception { + doTest("compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt"); + } + @TestMetadata("resolveWithFunctionLiteralWithId.kt") public void testResolveWithFunctionLiteralWithId() throws Exception { doTest("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");