fix: expect [] on a non-empty list now fails.

This commit is contained in:
microproofs
2023-04-21 17:21:08 -04:00
committed by Kasey
parent 0066765ae5
commit 9bb1a88f23
5 changed files with 103 additions and 455 deletions

View File

@@ -219,6 +219,9 @@ pub enum Air {
FieldsEmpty {
scope: Scope,
},
ListEmpty {
scope: Scope,
},
}
impl Air {
@@ -257,6 +260,7 @@ impl Air {
| Air::RecordAccess { scope, .. }
| Air::FieldsExpose { scope, .. }
| Air::FieldsEmpty { scope }
| Air::ListEmpty { scope }
| Air::ListAccessor { scope, .. }
| Air::ListExpose { scope, .. }
| Air::TupleAccessor { scope, .. }
@@ -301,6 +305,7 @@ impl Air {
| Air::RecordAccess { scope, .. }
| Air::FieldsExpose { scope, .. }
| Air::FieldsEmpty { scope }
| Air::ListEmpty { scope }
| Air::ListAccessor { scope, .. }
| Air::ListExpose { scope, .. }
| Air::TupleAccessor { scope, .. }
@@ -398,6 +403,7 @@ impl Air {
| Air::Finally { .. }
| Air::FieldsExpose { .. }
| Air::FieldsEmpty { .. }
| Air::ListEmpty { .. }
| Air::NoOp { .. } => None,
Air::UnOp { op, .. } => match op {
UnOp::Not => Some(

View File

@@ -781,6 +781,16 @@ impl AirStack {
self.call(void(), expect_stack, vec![tail_stack, arg_stack2])
}
pub fn list_empty(&mut self, value_stack: AirStack) {
self.new_scope();
self.air.push(Air::ListEmpty {
scope: self.scope.clone(),
});
self.merge_child(value_stack);
}
}
#[cfg(test)]