equal
deleted
inserted
replaced
3008 Type owntype = types.createErrorType(tree.type); |
3008 Type owntype = types.createErrorType(tree.type); |
3009 if (operator.kind == MTH && |
3009 if (operator.kind == MTH && |
3010 !left.isErroneous() && |
3010 !left.isErroneous() && |
3011 !right.isErroneous()) { |
3011 !right.isErroneous()) { |
3012 owntype = operator.type.getReturnType(); |
3012 owntype = operator.type.getReturnType(); |
|
3013 // This will figure out when unboxing can happen and |
|
3014 // choose the right comparison operator. |
3013 int opc = chk.checkOperator(tree.lhs.pos(), |
3015 int opc = chk.checkOperator(tree.lhs.pos(), |
3014 (OperatorSymbol)operator, |
3016 (OperatorSymbol)operator, |
3015 tree.getTag(), |
3017 tree.getTag(), |
3016 left, |
3018 left, |
3017 right); |
3019 right); |
3035 } |
3037 } |
3036 } |
3038 } |
3037 } |
3039 } |
3038 |
3040 |
3039 // Check that argument types of a reference ==, != are |
3041 // Check that argument types of a reference ==, != are |
3040 // castable to each other, (JLS???). |
3042 // castable to each other, (JLS 15.21). Note: unboxing |
|
3043 // comparisons will not have an acmp* opc at this point. |
3041 if ((opc == ByteCodes.if_acmpeq || opc == ByteCodes.if_acmpne)) { |
3044 if ((opc == ByteCodes.if_acmpeq || opc == ByteCodes.if_acmpne)) { |
3042 if (!types.isCastable(left, right, new Warner(tree.pos()))) { |
3045 if (!types.isEqualityComparable(left, right, |
|
3046 new Warner(tree.pos()))) { |
3043 log.error(tree.pos(), "incomparable.types", left, right); |
3047 log.error(tree.pos(), "incomparable.types", left, right); |
3044 } |
3048 } |
3045 } |
3049 } |
3046 |
3050 |
3047 chk.checkDivZero(tree.rhs.pos(), operator, right); |
3051 chk.checkDivZero(tree.rhs.pos(), operator, right); |