Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.3k
Infer empty list without annotation for __slots__ and module __all__#19348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6bf8602cdc257384b88493139f49e083e5c585bc153117300File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -496,6 +496,29 @@ class A: | ||
| self.missing = 3 | ||
| [builtins fixtures/dict.pyi] | ||
| [case testSlotsNotInClass] | ||
| # Shouldn't be triggered | ||
| __slots__ = [1, 2] | ||
sterliakov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| reveal_type(__slots__) # N: Revealed type is "builtins.list[builtins.int]" | ||
| def foo() -> None: | ||
| __slots__ = 1 | ||
sterliakov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| reveal_type(__slots__) # N: Revealed type is "builtins.int" | ||
| [case testSlotsEmptyList] | ||
| class A: | ||
sterliakov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| __slots__ = [] | ||
| reveal_type(__slots__) # N: Revealed type is "builtins.list[builtins.str]" | ||
| reveal_type(A.__slots__) # N: Revealed type is "builtins.list[builtins.str]" | ||
| [case testSlotsEmptySet] | ||
| class A: | ||
| __slots__ = set() | ||
| reveal_type(__slots__) # N: Revealed type is "builtins.set[builtins.str]" | ||
| reveal_type(A.__slots__) # N: Revealed type is "builtins.set[builtins.str]" | ||
| [builtins fixtures/set.pyi] | ||
| [case testSlotsWithAny] | ||
| from typing import Any | ||
Uh oh!
There was an error while loading. Please reload this page.