[ty] Narrow type context during literal promotion in generic class constructors (#21574)

## Summary

Resolves https://github.com/astral-sh/ty/issues/1603.
This commit is contained in:
Ibraheem Ahmed
2025-11-21 17:05:32 -05:00
committed by GitHub
parent 09d457aa52
commit 040aa7463b
2 changed files with 8 additions and 4 deletions

View File

@@ -3504,9 +3504,10 @@ impl<'db> Type<'db> {
return;
};
let tcx_specialization = tcx
.annotation
.and_then(|tcx| tcx.specialization_of(db, class_literal));
let tcx_specialization = tcx.annotation.and_then(|tcx| {
tcx.filter_union(db, |ty| ty.specialization_of(db, class_literal).is_some())
.specialization_of(db, class_literal)
});
for (typevar, ty) in specialization
.generic_context(db)