Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Literal comparison with BinaryOperator #1397

Merged
merged 23 commits into from Sep 11, 2023
Merged

Conversation

ding-co
Copy link
Contributor

@ding-co ding-co commented Sep 2, 2023

resolves #1306

@ever0de ever0de added the bug Something isn't working label Sep 2, 2023
@ever0de
Copy link
Member

ever0de commented Sep 2, 2023

It seems better to create a branch from the latest upstream/main than to work from origin/main.
If you do this, the commit included in the PR will not have the old commit in it, which is good for review.

@ding-co
Copy link
Contributor Author

ding-co commented Sep 2, 2023

It seems better to create a branch from the latest upstream/main than to work from origin/main.

If you do this, the commit included in the PR will not have the old commit in it, which is good for review.

Thank you!

Comment on lines 52 to 57
BinaryOperator::LtEq => {
if l.evaluate_cmp(&r).is_none() {
return Ok(Evaluated::from(Value::Bool(false)));
}
cmp!(l.evaluate_cmp(&r) != Some(Ordering::Greater))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matches! would be useful. same approach can be applied for BinaryOperator::GtEq

BinaryOperator::LtEq => cmp!(matches!(
    l.evaluate_cmp(&r),
    Some(Ordering::Less) | Some(Ordering::Equal)
)),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! matches! macro thank you~

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6145793371

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.177%

Totals Coverage Status
Change from base Build 6130860688: 0.0%
Covered Lines: 50147
Relevant Lines: 50563

💛 - Coveralls

Copy link
Member

@panarch panarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! Thanks a lot 👍

@panarch panarch merged commit 29c0f29 into gluesql:main Sep 11, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Literal comparison with BinaryOperator
4 participants