[ty] Include the specialization of a generic TypedDict as part of its display (#22174)
## Summary This is the easy bit of https://github.com/astral-sh/ty/issues/2190 ## Test Plan mdtests updated
This commit is contained in:
@@ -980,11 +980,14 @@ impl<'db> FmtDetailed<'db> for DisplayRepresentation<'db> {
|
||||
}
|
||||
f.write_str("]")
|
||||
}
|
||||
Type::TypedDict(TypedDictType::Class(defining_class)) => defining_class
|
||||
.class_literal(self.db)
|
||||
.0
|
||||
.display_with(self.db, self.settings.clone())
|
||||
.fmt_detailed(f),
|
||||
Type::TypedDict(TypedDictType::Class(defining_class)) => match defining_class {
|
||||
ClassType::NonGeneric(class) => class
|
||||
.display_with(self.db, self.settings.clone())
|
||||
.fmt_detailed(f),
|
||||
ClassType::Generic(alias) => alias
|
||||
.display_with(self.db, self.settings.clone())
|
||||
.fmt_detailed(f),
|
||||
},
|
||||
Type::TypedDict(TypedDictType::Synthesized(synthesized)) => {
|
||||
f.set_invalid_type_annotation();
|
||||
f.write_char('<')?;
|
||||
|
||||
@@ -556,7 +556,7 @@ impl TypedDictAssignmentKind {
|
||||
/// Validates assignment of a value to a specific key on a `TypedDict`.
|
||||
///
|
||||
/// Returns true if the assignment is valid, or false otherwise.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(super) fn validate_typed_dict_key_assignment<'db, 'ast>(
|
||||
context: &InferContext<'db, 'ast>,
|
||||
typed_dict: TypedDictType<'db>,
|
||||
|
||||
Reference in New Issue
Block a user