Skip to content

Commit 4dc9865

Browse files
committed
work
1 parent 9f4c92d commit 4dc9865

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/array_checker.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct IndexConstraint {
1212
pub max: Option<i64>,
1313
}
1414

15-
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
15+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
1616
struct IndexInterval {
1717
pub min: i64,
1818
pub max: i64,
@@ -26,6 +26,12 @@ impl std::ops::Add<IndexInterval> for IndexInterval {
2626
}
2727
}
2828

29+
impl Default for IndexInterval {
30+
fn default() -> IndexInterval {
31+
IndexInterval { min: i64::min_value(), max: i64::max_value() }
32+
}
33+
}
34+
2935
fn enclose(a: IndexInterval, b: IndexInterval) -> IndexInterval {
3036
IndexInterval {
3137
min: a.min.min(b.min),
@@ -78,7 +84,7 @@ impl ArrayChecker {
7884
if let Expr::Binop(Binop::Less, lhs, rhs) = &decl.arena[expr] {
7985
if let Expr::Id(name) = &decl.arena[*lhs] {
8086
let ival = self.check_expr(*rhs, decl, decls);
81-
if ival.max == ival.min {
87+
if ival.max != i64::max_value() {
8288
self.add(*name, None, Some(ival.max - 1));
8389
}
8490
}

0 commit comments

Comments
 (0)