improved error reporting

when error type is a generic parameter
This commit is contained in:
Svetlana Isakova
2012-12-24 15:51:05 +04:00
parent 19e6b02da8
commit 4089ac68bd
3 changed files with 15 additions and 2 deletions
@@ -169,8 +169,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
return;
}
if (constrainingType == null || (ErrorUtils.containsErrorType(constrainingType)
&& !TypeUtils.equalsOrContainsAsArgument(constrainingType, DONT_CARE, CANT_INFER, PLACEHOLDER_FUNCTION_TYPE))) {
if (constrainingType == null || (ErrorUtils.isErrorType(constrainingType) && constrainingType != PLACEHOLDER_FUNCTION_TYPE)) {
hasErrorInConstrainingTypes = true;
return;
}
@@ -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");
}
@TestMetadata("ErrorTypeAsGenericParameter.kt")
public void testErrorTypeAsGenericParameter() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt");
}
@TestMetadata("NoAmbiguityForDifferentFunctionTypes.kt")
public void testNoAmbiguityForDifferentFunctionTypes() throws Exception {
doTest("compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt");