Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infer generic type arguments for slice expressions (#18160)
Fixes #18149 Slices were made generic in python/typeshed#11637. Currently, all slice expressions are inferred to have type `slice[Any, Any, Any]`. This PR fills in the generic type arguments more appropriately using start/stop/stride expression types. Given ```python class Foo: def __getitem__[T](self, item: T) -> T: return item x = Foo() reveal_type(x[1:]) ``` Before: ```none main.py:5: note: Revealed type is "builtins.slice[Any, Any, Any]" ``` After: ```none main.py:5: note: Revealed type is "builtins.slice[builtins.int, None, None]" ```
- Loading branch information