[ty] fix display of top ParamSpec specialization (#22227)
## Summary I only noticed this in the ecosystem report of https://github.com/astral-sh/ruff/pull/22213 after merging it. The change to displaying `Top[]` wrapper around the entire signature instead of just the parameters had the side effect of not showing it at all when displaying a top ParamSpec specialization. This PR fixes that. Marking internal since this is a fixup of a not-released PR. ## Test Plan Added mdtest that fails without this PR.
This commit is contained in:
@@ -1600,10 +1600,16 @@ impl<'db> FmtDetailed<'db> for DisplayCallableType<'_, 'db> {
|
||||
match self.signatures.overloads.as_slice() {
|
||||
[signature] => {
|
||||
if matches!(self.kind, CallableTypeKind::ParamSpecValue) {
|
||||
if signature.parameters().is_top() {
|
||||
f.write_str("Top[")?;
|
||||
}
|
||||
signature
|
||||
.parameters()
|
||||
.display_with(self.db, self.settings.clone())
|
||||
.fmt_detailed(f)?;
|
||||
if signature.parameters().is_top() {
|
||||
f.write_str("]")?;
|
||||
}
|
||||
} else {
|
||||
signature
|
||||
.display_with(self.db, self.settings.clone())
|
||||
|
||||
Reference in New Issue
Block a user