mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
[ty] Fix false-positive [invalid-return-type]
diagnostics on generator functions (#17871)
This commit is contained in:
parent
47e3aa40b3
commit
bb6c7cad07
8 changed files with 253 additions and 22 deletions
|
@ -13,7 +13,7 @@ use rustc_hash::FxHasher;
|
|||
use crate::ast_node_ref::AstNodeRef;
|
||||
use crate::node_key::NodeKey;
|
||||
use crate::semantic_index::visibility_constraints::ScopedVisibilityConstraintId;
|
||||
use crate::semantic_index::{semantic_index, SymbolMap};
|
||||
use crate::semantic_index::{semantic_index, SemanticIndex, SymbolMap};
|
||||
use crate::Db;
|
||||
|
||||
#[derive(Eq, PartialEq, Debug)]
|
||||
|
@ -170,6 +170,10 @@ impl FileScopeId {
|
|||
let index = semantic_index(db, file);
|
||||
index.scope_ids_by_scope[self]
|
||||
}
|
||||
|
||||
pub(crate) fn is_generator_function(self, index: &SemanticIndex) -> bool {
|
||||
index.generator_functions.contains(&self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, salsa::Update)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue