[ty] Recognise functions containing yield from expressions as being generator functions (#17930)

This commit is contained in:
Alex Waygood 2025-05-07 23:29:44 +01:00 committed by GitHub
parent 2cf5cba7ff
commit 51cef5a72b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 24 deletions

View file

@ -2310,7 +2310,7 @@ where
walk_expr(self, expr);
}
ast::Expr::Yield(_) => {
ast::Expr::Yield(_) | ast::Expr::YieldFrom(_) => {
let scope = self.current_scope();
if self.scopes[scope].kind() == ScopeKind::Function {
self.generator_functions.insert(scope);