-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[red-knot] Preliminary support for type aliases
- Loading branch information
Showing
10 changed files
with
194 additions
and
34 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
crates/red_knot_python_semantic/resources/mdtest/type_alias.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,17 @@ | ||
# Type aliases | ||
|
||
## Basic | ||
|
||
```py | ||
type MyInt = int | ||
|
||
# TODO: should be typing.TypeAliasType | ||
reveal_type(MyInt) # revealed: MyInt | ||
|
||
x: MyInt = 1 | ||
|
||
reveal_type(x) # revealed: Literal[1] | ||
|
||
def f() -> None: | ||
reveal_type(x) # revealed: int | ||
``` |
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
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
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
Oops, something went wrong.