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

Support Checking for Negative Domain #296

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#[derive(Error, Debug)]
enum CheckingError {
#[error("columns for {} not found in trace file", .0.pretty())]
NoColumnsFound(Handle),

Check warning on line 19 in src/check.rs

View workflow job for this annotation

GitHub Actions / build

variant `NoColumnsFound` is never constructed
#[error("")]
FailingConstraint(Handle, String),
#[error("")]
Expand Down Expand Up @@ -193,7 +193,6 @@
.collect(),
)
}

let mut trace = String::new();
for ii in 0..m_columns[0].len() {
for (j, col) in m_columns.iter().enumerate() {
Expand All @@ -218,7 +217,6 @@
trace.push('\n');
}
trace.push('\n');

bail!(
trace
+ &expr.debug(
Expand Down Expand Up @@ -299,7 +297,16 @@
match domain {
Some(is) => {
for i in is.iter() {
check_constraint_at(cs, expr, i, true, true, &mut cache, settings)?;
let err = check_constraint_at(cs, expr, i, true, true, &mut cache, settings)
.map_err(|e| CheckingError::FailingConstraint(name.clone(), e.to_string()));

if err.is_err() {
if settings.continue_on_error {
eprintln!("{:?}", err);
} else {
bail!(err.err().unwrap());
}
}
}
}
None => {
Expand Down
7 changes: 4 additions & 3 deletions src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,11 @@ impl ValueBacking {
if i < 0 {
if wrap {
let new_i = v.len() as isize + i;
if new_i < 0 || new_i >= v.len() as isize {
panic!("abnormal wrapping value {}", new_i)
if new_i < 0 {
Some(v.get(0).unwrap())
} else {
v.get(new_i as usize)
}
v.get((v.len() as isize + i) as usize)
} else if i < -spilling {
Some(v.get(0).unwrap())
} else {
Expand Down
Loading