[ty] Support extending __all__ with a literal tuple or set as well as a literal list (#17948)

This commit is contained in:
Alex Waygood 2025-05-08 17:37:25 +01:00 committed by GitHub
parent da8540862d
commit 0763331f7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View file

@ -269,6 +269,8 @@ import subexporter
__all__ = []
__all__.extend(["C", "D"])
__all__.extend(("E", "F"))
__all__.extend({"G", "H"})
__all__.extend(subexporter.__all__)
class C: ...
@ -281,7 +283,7 @@ class D: ...
import exporter
from ty_extensions import dunder_all_names
# revealed: tuple[Literal["A"], Literal["B"], Literal["C"], Literal["D"]]
# revealed: tuple[Literal["A"], Literal["B"], Literal["C"], Literal["D"], Literal["E"], Literal["F"], Literal["G"], Literal["H"]]
reveal_type(dunder_all_names(exporter))
```