1
0
forked from M-Labs/nac3

nac3core: type inferencer fix the pass statement

This commit is contained in:
ychenfo 2021-09-21 13:19:13 +08:00
parent df6c9c8a35
commit 1c170f5c41
2 changed files with 2 additions and 2 deletions

View File

@ -939,7 +939,7 @@ fn test_analyze(source: Vec<&str>, res: Vec<&str>) {
indoc! {" indoc! {"
class A: class A:
def fun(self): def fun(self):
1 + 2 pass
"}, "},
indoc!{" indoc!{"
class B: class B:

View File

@ -128,7 +128,7 @@ impl<'a> fold::Fold<()> for Inferencer<'a> {
} }
} }
ast::StmtKind::AnnAssign { .. } | ast::StmtKind::Expr { .. } => {} ast::StmtKind::AnnAssign { .. } | ast::StmtKind::Expr { .. } => {}
ast::StmtKind::Break | ast::StmtKind::Continue => {} ast::StmtKind::Break | ast::StmtKind::Continue | ast::StmtKind::Pass => {}
ast::StmtKind::Return { value } => match (value, self.function_data.return_type) { ast::StmtKind::Return { value } => match (value, self.function_data.return_type) {
(Some(v), Some(v1)) => { (Some(v), Some(v1)) => {
self.unify(v.custom.unwrap(), v1, &v.location)?; self.unify(v.custom.unwrap(), v1, &v.location)?;