[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:
David Peter 2025-07-08 16:16:50 +02:00 committed by GitHub
parent d78d10dd94
commit ce2bdb9357
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 91 additions and 1 deletions

View file

@ -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(..)