improved error reporting
when error type is a generic parameter
This commit is contained in:
+1
-2
@@ -169,8 +169,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constrainingType == null || (ErrorUtils.containsErrorType(constrainingType)
|
if (constrainingType == null || (ErrorUtils.isErrorType(constrainingType) && constrainingType != PLACEHOLDER_FUNCTION_TYPE)) {
|
||||||
&& !TypeUtils.equalsOrContainsAsArgument(constrainingType, DONT_CARE, CANT_INFER, PLACEHOLDER_FUNCTION_TYPE))) {
|
|
||||||
hasErrorInConstrainingTypes = true;
|
hasErrorInConstrainingTypes = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun <T, R, S> foo(block: (T)-> R, <!UNUSED_PARAMETER!>second<!>: (T)-> S) = block
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val fff = { (x: Int) -> <!UNRESOLVED_REFERENCE!>aaa<!> }
|
||||||
|
foo(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fff<!>, { x -> x + 1 })
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2270,6 +2270,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt");
|
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ErrorTypeAsGenericParameter.kt")
|
||||||
|
public void testErrorTypeAsGenericParameter() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("NoAmbiguityForDifferentFunctionTypes.kt")
|
@TestMetadata("NoAmbiguityForDifferentFunctionTypes.kt")
|
||||||
public void testNoAmbiguityForDifferentFunctionTypes() throws Exception {
|
public void testNoAmbiguityForDifferentFunctionTypes() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt");
|
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user