mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
[ty] Conditionally defined dataclass fields (#19197)
## Summary Fixes a bug where conditionally defined dataclass fields were previously ignored. Thanks to @lipefree for reporting this. ## Test Plan New Markdown tests
This commit is contained in:
parent
d78d10dd94
commit
ce2bdb9357
3 changed files with 91 additions and 1 deletions
|
@ -1650,7 +1650,7 @@ impl<'db> ClassLiteral<'db> {
|
|||
if !declarations
|
||||
.clone()
|
||||
.all(|DeclarationWithConstraint { declaration, .. }| {
|
||||
declaration.is_defined_and(|declaration| {
|
||||
declaration.is_undefined_or(|declaration| {
|
||||
matches!(
|
||||
declaration.kind(db),
|
||||
DefinitionKind::AnnotatedAssignment(..)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue