Don't complain about compareTo returning ERROR type instead of Int
This commit is contained in:
+1
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user