Assert against empty parameter lists

This commit is contained in:
Patrick Lühne 2020-02-02 20:06:41 +01:00
parent 5e39fc5cec
commit 171c725fb8
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 8 additions and 0 deletions

View File

@ -502,6 +502,8 @@ impl Formula
pub fn exists(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
{
assert!(!parameters.is_empty());
Self::Exists(Exists::new(parameters, argument))
}
@ -517,6 +519,8 @@ impl Formula
pub fn for_all(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
{
assert!(!parameters.is_empty());
Self::ForAll(ForAll::new(parameters, argument))
}

View File

@ -205,6 +205,8 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
{
crate::Formula::Exists(exists) =>
{
assert!(!exists.parameters.is_empty());
write!(format, "exists")?;
let mut separator = " ";
@ -220,6 +222,8 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
},
crate::Formula::ForAll(for_all) =>
{
assert!(!for_all.parameters.is_empty());
write!(format, "forall")?;
let mut separator = " ";