fixed fold

This commit is contained in:
pca006132 2021-07-28 10:44:58 +08:00
parent e15473d2c9
commit f665ea358b

View File

@ -56,9 +56,9 @@ impl<'a> fold::Fold<()> for Inferencer<'a> {
let stmt = match node.node { let stmt = match node.node {
// we don't want fold over type annotation // we don't want fold over type annotation
ast::StmtKind::AnnAssign { target, annotation, value, simple } => { ast::StmtKind::AnnAssign { target, annotation, value, simple } => {
let target = Box::new(fold::fold_expr(self, *target)?); let target = Box::new(self.fold_expr(*target)?);
let value = if let Some(v) = value { let value = if let Some(v) = value {
let ty = Box::new(fold::fold_expr(self, *v)?); let ty = Box::new(self.fold_expr(*v)?);
self.unifier.unify(target.custom.unwrap(), ty.custom.unwrap())?; self.unifier.unify(target.custom.unwrap(), ty.custom.unwrap())?;
Some(ty) Some(ty)
} else { } else {