fixed: use function placeholder when there is no declared value parameter list
(not when there is no value parameters)
This commit is contained in:
+2
-2
@@ -202,10 +202,10 @@ public class ArgumentTypeResolver {
|
||||
@NotNull JetScope scope,
|
||||
@NotNull BindingTrace trace
|
||||
) {
|
||||
List<JetParameter> valueParameters = expression.getValueParameters();
|
||||
if (valueParameters.isEmpty()) {
|
||||
if (expression.getFunctionLiteral().getValueParameterList() == null) {
|
||||
return PLACEHOLDER_FUNCTION_TYPE;
|
||||
}
|
||||
List<JetParameter> valueParameters = expression.getValueParameters();
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(
|
||||
trace, "trace to resolve function literal parameter types");
|
||||
List<JetType> parameterTypes = Lists.newArrayList();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package a
|
||||
|
||||
fun <T> emptyList(): List<T> = throw Exception()
|
||||
|
||||
fun foo<T>(f: T.() -> Unit, l: List<T>): T = throw Exception("$f$l")
|
||||
|
||||
fun test() {
|
||||
val q = foo({ Int.() -> }, emptyList()) //type inference no information for parameter error
|
||||
q: Int
|
||||
|
||||
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>({}, <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>())
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user