diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java index 1aa9a9de86e..557f4f056fa 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ArgumentTypeResolver.java @@ -202,10 +202,10 @@ public class ArgumentTypeResolver { @NotNull JetScope scope, @NotNull BindingTrace trace ) { - List valueParameters = expression.getValueParameters(); - if (valueParameters.isEmpty()) { + if (expression.getFunctionLiteral().getValueParameterList() == null) { return PLACEHOLDER_FUNCTION_TYPE; } + List valueParameters = expression.getValueParameters(); TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create( trace, "trace to resolve function literal parameter types"); List parameterTypes = Lists.newArrayList(); diff --git a/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt b/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt new file mode 100644 index 00000000000..869b1b6a2a8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt @@ -0,0 +1,12 @@ +package a + +fun emptyList(): List = throw Exception() + +fun foo(f: T.() -> Unit, l: List): T = throw Exception("$f$l") + +fun test() { + val q = foo({ Int.() -> }, emptyList()) //type inference no information for parameter error + q: Int + + foo({}, emptyList()) +} \ 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 dd077dee827..f56e0c727e6 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -2755,6 +2755,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt"); } + @TestMetadata("functionPlaceholderError.kt") + public void testFunctionPlaceholderError() throws Exception { + doTest("compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt"); + } + @TestMetadata("hasErrorInConstrainingTypes.kt") public void testHasErrorInConstrainingTypes() throws Exception { doTest("compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt");