-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[red-knot] Never is callable and iterable. Arbitrary attributes can b…
…e accessed. (#16533) ## Summary - `Never` is callable - `Never` is iterable - Arbitrary attributes can be accessed on `Never` Split out from #16416 that is going to be required. ## Test Plan Tests for all properties above.
- Loading branch information
Showing
4 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/red_knot_python_semantic/resources/mdtest/call/never.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Never is callable | ||
|
||
The type `Never` is callable with an arbitrary set of arguments. The result is always `Never`. | ||
|
||
```py | ||
from typing_extensions import Never | ||
|
||
def f(never: Never): | ||
reveal_type(never()) # revealed: Never | ||
reveal_type(never(1)) # revealed: Never | ||
reveal_type(never(1, "a", never, x=None)) # revealed: Never | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters