[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

@@ -335,6 +335,9 @@ reveal_type(x19) # revealed: list[Literal[1]]
x20: list[Literal[1]] | None = [1]
reveal_type(x20) # revealed: list[Literal[1]]
x21: X[Literal[1]] | None = x(1)
x21: X[Literal[1]] | None = X(1)
reveal_type(x21) # revealed: X[Literal[1]]
x22: X[Literal[1]] | None = x(1)
reveal_type(x22) # revealed: X[Literal[1]]
```