Don't complain about compareTo returning ERROR type instead of Int

This commit is contained in:
Andrey Breslav
2012-09-20 15:11:22 +04:00
parent 2abe2e581d
commit 936f53fcbf
3 changed files with 11 additions and 1 deletions
@@ -974,7 +974,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
else if (OperatorConventions.COMPARISON_OPERATIONS.contains(operationType)) {
JetType compareToReturnType = getTypeForBinaryCall(context.scope, Name.identifier("compareTo"), context, expression);
if (compareToReturnType != null) {
if (compareToReturnType != null && !ErrorUtils.isErrorType(compareToReturnType)) {
TypeConstructor constructor = compareToReturnType.getConstructor();
JetStandardLibrary standardLibrary = JetStandardLibrary.getInstance();
TypeConstructor intTypeConstructor = standardLibrary.getInt().getTypeConstructor();
@@ -0,0 +1,5 @@
fun test() {
if (<!UNRESOLVED_REFERENCE!>x<!> > 0) {
}
}
@@ -141,6 +141,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/ClassObjects.kt");
}
@TestMetadata("CompareToWithErrorType.kt")
public void testCompareToWithErrorType() throws Exception {
doTest("compiler/testData/diagnostics/tests/CompareToWithErrorType.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
doTest("compiler/testData/diagnostics/tests/Constants.kt");