mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-17 00:50:16 +00:00
[flake8-type-checking] Fix false positives for typing.Annotated
(#14311)
This commit is contained in:
parent
f789b12705
commit
89aa804b2d
7 changed files with 51 additions and 5 deletions
|
@ -87,6 +87,11 @@ impl ResolvedReference {
|
|||
.intersects(SemanticModelFlags::DEFERRED_TYPE_DEFINITION)
|
||||
}
|
||||
|
||||
/// Return `true` if the context is in any kind of type definition.
|
||||
pub const fn in_type_definition(&self) -> bool {
|
||||
self.flags.intersects(SemanticModelFlags::TYPE_DEFINITION)
|
||||
}
|
||||
|
||||
/// Return `true` if the context is in a type-checking block.
|
||||
pub const fn in_type_checking_block(&self) -> bool {
|
||||
self.flags
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue