Skip to content

Commit

Permalink
#421 fixes inconsistent equals behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
uklimaschewski committed Jan 15, 2024
1 parent 3d8fb02 commit 50a122b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class InfixEqualsOperator extends AbstractOperator {
@Override
public EvaluationValue evaluate(
Expression expression, Token operatorToken, EvaluationValue... operands) {
if (operands[0].getDataType() != operands[1].getDataType()) {
return EvaluationValue.booleanValue(false);
}
if (operands[0].isNullValue() && operands[1].isNullValue()) {
return EvaluationValue.booleanValue(true);
}
if (operands[0].isNullValue() || operands[1].isNullValue()) {
return EvaluationValue.booleanValue(false);
}
return expression.convertValue(operands[0].compareTo(operands[1]) == 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class InfixNotEqualsOperator extends AbstractOperator {
@Override
public EvaluationValue evaluate(
Expression expression, Token operatorToken, EvaluationValue... operands) {
if (operands[0].getDataType() != operands[1].getDataType()) {
return EvaluationValue.booleanValue(true);
}
if (operands[0].isNullValue() && operands[1].isNullValue()) {
return EvaluationValue.booleanValue(false);
}
if (operands[0].isNullValue() || operands[1].isNullValue()) {
return EvaluationValue.booleanValue(true);
}
return expression.convertValue(operands[0].compareTo(operands[1]) != 0);
}
}

0 comments on commit 50a122b

Please sign in to comment.