Collect and display evaluation hints on test failures.

This commit is contained in:
KtorZ
2022-12-14 22:00:56 +01:00
parent 7b22b63ad8
commit 978a6c6981
3 changed files with 93 additions and 10 deletions

View File

@@ -85,6 +85,21 @@ pub struct Function<T, Expr> {
pub type TypedTypeAlias = TypeAlias<Arc<Type>>;
pub type UntypedTypeAlias = TypeAlias<()>;
impl TypedFunction {
pub fn test_hint(&self) -> Option<(BinOp, Box<TypedExpr>, Box<TypedExpr>)> {
match &self.body {
TypedExpr::BinOp {
name,
tipo,
left,
right,
..
} if tipo == &bool() => Some((name.clone(), left.clone(), right.clone())),
_ => None,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeAlias<T> {
pub alias: String,