Do not allow compareTo() to return Int?

This commit is contained in:
Andrey Breslav
2014-11-26 20:14:44 +03:00
parent 304d22553c
commit 4adf74b46f
4 changed files with 30 additions and 3 deletions
@@ -1015,10 +1015,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType compareToReturnType = typeInfo.getType();
JetType type = null;
if (compareToReturnType != null && !compareToReturnType.isError()) {
TypeConstructor constructor = compareToReturnType.getConstructor();
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
TypeConstructor intTypeConstructor = builtIns.getInt().getTypeConstructor();
if (constructor.equals(intTypeConstructor)) {
if (JetTypeChecker.DEFAULT.equalTypes(builtIns.getIntType(), compareToReturnType)) {
type = builtIns.getBooleanType();
}
else {