File tree Expand file tree Collapse file tree 5 files changed +24
-16
lines changed
crates/red_knot_python_semantic/resources/mdtest Expand file tree Collapse file tree 5 files changed +24
-16
lines changed Original file line number Diff line number Diff line change 11# ` LiteralString `
22
3- ``` toml
4- [environment ]
5- target-version = " 3.11"
6- ```
7-
83` LiteralString ` represents a string that is either defined directly within the source code or is
94made up of such components.
105
Original file line number Diff line number Diff line change 11# NoReturn & Never
22
3- ``` toml
4- [environment ]
5- target-version = " 3.11"
6- ```
7-
83` NoReturn ` is used to annotate the return type for functions that never return. ` Never ` is the
94bottom type, representing the empty set of Python objects. These two annotations can be used
105interchangeably.
@@ -52,7 +47,7 @@ def f():
5247
5348## ` typing.Never `
5449
55- ` typing.Never ` is only available in Python 3.11 and later:
50+ ### Python 3.11
5651
5752``` toml
5853[environment ]
@@ -61,9 +56,22 @@ target-version = "3.11"
6156
6257``` py
6358from typing import Never
59+ from typing import Never
6460
65- x: Never
61+ reveal_type(Never) # revealed: typing.Never
62+ ```
6663
67- def f ():
68- reveal_type(x) # revealed: Never
64+ ### Python 3.10
65+
66+ ``` toml
67+ [environment ]
68+ target-version = " 3.10"
69+ ```
70+
71+ ``` py
72+ # TODO : should raise a diagnostic
73+ from typing import Never
74+
75+ # TODO : this should be Unknown
76+ reveal_type(Never) # revealed: Never
6977```
Original file line number Diff line number Diff line change 11# Except star
22
3+ ` except* ` is only available in Python 3.11 and later:
4+
35``` toml
46[environment ]
57target-version = " 3.11"
Original file line number Diff line number Diff line change @@ -101,14 +101,15 @@ else:
101101
102102### Handling of ` None `
103103
104+ ` types.NoneType ` is only available in Python 3.10 and later:
105+
104106``` toml
105107[environment ]
106108target-version = " 3.10"
107109```
108110
109111``` py
110- # TODO : this error should ideally go away once we (1) understand `sys.version_info` branches,
111- # and (2) set the target Python version for this test to 3.10.
112+ # TODO : this error should ideally go away once we understand `sys.version_info` branches.
112113# error: [possibly-unbound-import] "Member `NoneType` of module `types` is possibly unbound"
113114from types import NoneType
114115
Original file line number Diff line number Diff line change 11# Type aliases
22
3+ Type aliases are only available in Python 3.12 and later:
4+
35``` toml
46[environment ]
57target-version = " 3.12"
You can’t perform that action at this time.
0 commit comments