Fix handling of Lt, LtEq (#393)

Changed the middleware to only allow comparison of integers and to
use the implementation of Ord for i64.  This matches the backend
behavior.

Also fixed a separate bug where LtEqFromEntries was producing a
NotEquals statement.
This commit is contained in:
Daniel Gulotta 2025-08-18 07:54:20 -07:00 committed by GitHub
parent 1508dd6126
commit f76197c602
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 27 deletions

View file

@ -7,10 +7,7 @@ use hex::ToHex;
use itertools::Itertools;
use strum_macros::FromRepr;
mod basetypes;
use std::{
cmp::{Ordering, PartialEq, PartialOrd},
hash,
};
use std::{cmp::PartialEq, hash};
use containers::{Array, Dictionary, Set};
use schemars::JsonSchema;
@ -254,7 +251,7 @@ impl fmt::Display for TypedValue {
}
TypedValue::Set(s) => {
write!(f, "#[")?;
let values: Vec<_> = s.set().iter().sorted().collect();
let values: Vec<_> = s.set().iter().sorted_by_key(|k| k.raw()).collect();
for (i, v) in values.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
@ -461,18 +458,6 @@ impl PartialEq for Value {
impl Eq for Value {}
impl PartialOrd for Value {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Value {
fn cmp(&self, other: &Self) -> Ordering {
self.raw.cmp(&other.raw)
}
}
impl hash::Hash for Value {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.raw.hash(state)