feat: Add specific messages for using expect with booleans

TODO: fill out the rest of the expects with messages
This commit is contained in:
microproofs
2024-01-02 21:52:01 -05:00
committed by Kasey
parent 7b452c21f0
commit 71cfb6f6af
8 changed files with 184 additions and 68 deletions

View File

@@ -131,6 +131,7 @@ pub enum AirStatement {
AssertBool {
is_true: bool,
value: Box<AirTree>,
msg: String,
},
// Clause Guards
ClauseGuard {
@@ -501,11 +502,12 @@ impl AirTree {
hoisted_over: None,
}
}
pub fn assert_bool(is_true: bool, value: AirTree) -> AirTree {
pub fn assert_bool(is_true: bool, value: AirTree, msg: String) -> AirTree {
AirTree::Statement {
statement: AirStatement::AssertBool {
is_true,
value: value.into(),
msg,
},
hoisted_over: None,
}
@@ -950,8 +952,15 @@ impl AirTree {
});
constr.create_air_vec(air_vec);
}
AirStatement::AssertBool { is_true, value } => {
air_vec.push(Air::AssertBool { is_true: *is_true });
AirStatement::AssertBool {
is_true,
value,
msg,
} => {
air_vec.push(Air::AssertBool {
is_true: *is_true,
msg: msg.clone(),
});
value.create_air_vec(air_vec);
}
AirStatement::ClauseGuard {