Skip to content

Commit 7da44bd

Browse files
committed
Merge branch 'dcreager/alist-type' into dcreager/arc-it
* dcreager/alist-type: Remove unneeded shear override Update property test CI Move alist into red_knot_python_semantic [red-knot] Switch to a handwritten parser for mdtest error assertions (#16422) [red-knot] Disallow more invalid type expressions (#16427) Bump version to Ruff 0.9.9 (#16434) Check `LinterSettings::preview` for version-related syntax errors (#16429) Avoid caching files with unsupported syntax errors (#16425) Prioritize "bug" label for changelog sections (#16433) [`flake8-copyright`] Add links to applicable options (`CPY001`) (#16421) Fix string-length limit in documentation for PYI054 (#16432) Show version-related syntax errors in the playground (#16419) Allow passing `ParseOptions` to inline tests (#16357) Bump version to 0.9.8 (#16414) [red-knot] Ignore surrounding whitespace when looking for `<!-- snapshot-diagnostics -->` directives in mdtests (#16380) Notify users for invalid client settings (#16361) Avoid indexing the project if `configurationPreference` is `editorOnly` (#16381)
2 parents ce630f0 + c95272e commit 7da44bd

File tree

42 files changed

+1324
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1324
-486
lines changed

.github/workflows/daily_property_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: |
4848
export QUICKCHECK_TESTS=100000
4949
for _ in {1..5}; do
50-
cargo test --locked --release --package ruff_index -- --ignored list::property_tests
50+
cargo test --locked --release --package red_knot_python_semantic -- --ignored list::property_tests
5151
cargo test --locked --release --package red_knot_python_semantic -- --ignored types::property_tests::stable
5252
done
5353

CHANGELOG.md

+46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
# Changelog
22

3+
## 0.9.9
4+
5+
### Preview features
6+
7+
- Fix caching of unsupported-syntax errors ([#16425](https://github.com/astral-sh/ruff/pull/16425))
8+
9+
### Bug fixes
10+
11+
- Only show unsupported-syntax errors in editors when preview mode is enabled ([#16429](https://github.com/astral-sh/ruff/pull/16429))
12+
13+
## 0.9.8
14+
15+
### Preview features
16+
17+
- Start detecting version-related syntax errors in the parser ([#16090](https://github.com/astral-sh/ruff/pull/16090))
18+
19+
### Rule changes
20+
21+
- \[`pylint`\] Mark fix unsafe (`PLW1507`) ([#16343](https://github.com/astral-sh/ruff/pull/16343))
22+
- \[`pylint`\] Catch `case np.nan`/`case math.nan` in `match` statements (`PLW0177`) ([#16378](https://github.com/astral-sh/ruff/pull/16378))
23+
- \[`ruff`\] Add more Pydantic models variants to the list of default copy semantics (`RUF012`) ([#16291](https://github.com/astral-sh/ruff/pull/16291))
24+
25+
### Server
26+
27+
- Avoid indexing the project if `configurationPreference` is `editorOnly` ([#16381](https://github.com/astral-sh/ruff/pull/16381))
28+
- Avoid unnecessary info at non-trace server log level ([#16389](https://github.com/astral-sh/ruff/pull/16389))
29+
- Expand `ruff.configuration` to allow inline config ([#16296](https://github.com/astral-sh/ruff/pull/16296))
30+
- Notify users for invalid client settings ([#16361](https://github.com/astral-sh/ruff/pull/16361))
31+
32+
### Configuration
33+
34+
- Add `per-file-target-version` option ([#16257](https://github.com/astral-sh/ruff/pull/16257))
35+
36+
### Bug fixes
37+
38+
- \[`refurb`\] Do not consider docstring(s) (`FURB156`) ([#16391](https://github.com/astral-sh/ruff/pull/16391))
39+
- \[`flake8-self`\] Ignore attribute accesses on instance-like variables (`SLF001`) ([#16149](https://github.com/astral-sh/ruff/pull/16149))
40+
- \[`pylint`\] Fix false positives, add missing methods, and support positional-only parameters (`PLE0302`) ([#16263](https://github.com/astral-sh/ruff/pull/16263))
41+
- \[`flake8-pyi`\] Mark `PYI030` fix unsafe when comments are deleted ([#16322](https://github.com/astral-sh/ruff/pull/16322))
42+
43+
### Documentation
44+
45+
- Fix example for `S611` ([#16316](https://github.com/astral-sh/ruff/pull/16316))
46+
- Normalize inconsistent markdown headings in docstrings ([#16364](https://github.com/astral-sh/ruff/pull/16364))
47+
- Document MSRV policy ([#16384](https://github.com/astral-sh/ruff/pull/16384))
48+
349
## 0.9.7
450

551
### Preview features

Cargo.lock

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ pretty_assertions = "1.3.0"
117117
proc-macro2 = { version = "1.0.79" }
118118
pyproject-toml = { version = "0.13.4" }
119119
quick-junit = { version = "0.5.0" }
120-
quickcheck = { version = "1.0.3", default-features = false }
121-
quickcheck_macros = { version = "1.0.0" }
122120
quote = { version = "1.0.23" }
123121
rand = { version = "0.9.0" }
124122
rayon = { version = "1.10.0" }

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
149149
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
150150

151151
# For a specific version.
152-
curl -LsSf https://astral.sh/ruff/0.9.7/install.sh | sh
153-
powershell -c "irm https://astral.sh/ruff/0.9.7/install.ps1 | iex"
152+
curl -LsSf https://astral.sh/ruff/0.9.9/install.sh | sh
153+
powershell -c "irm https://astral.sh/ruff/0.9.9/install.ps1 | iex"
154154
```
155155

156156
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -183,7 +183,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
183183
```yaml
184184
- repo: https://github.com/astral-sh/ruff-pre-commit
185185
# Ruff version.
186-
rev: v0.9.7
186+
rev: v0.9.9
187187
hooks:
188188
# Run the linter.
189189
- id: ruff

crates/red_knot_python_semantic/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ anyhow = { workspace = true }
5555
dir-test = { workspace = true }
5656
insta = { workspace = true }
5757
tempfile = { workspace = true }
58-
quickcheck = { workspace = true }
59-
quickcheck_macros = { workspace = true }
58+
quickcheck = { version = "1.0.3", default-features = false }
59+
quickcheck_macros = { version = "1.0.0" }
6060

6161
[features]
6262
serde = ["ruff_db/serde", "dep:serde", "ruff_python_ast/serde"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Tests for invalid types in type expressions
2+
3+
## Invalid types are rejected
4+
5+
Many types are illegal in the context of a type expression:
6+
7+
```py
8+
import typing
9+
from knot_extensions import AlwaysTruthy, AlwaysFalsy
10+
from typing_extensions import Literal, Never
11+
12+
def _(
13+
a: type[int],
14+
b: AlwaysTruthy,
15+
c: AlwaysFalsy,
16+
d: Literal[True],
17+
e: Literal["bar"],
18+
f: Literal[b"foo"],
19+
g: tuple[int, str],
20+
h: Never,
21+
):
22+
def foo(): ...
23+
def invalid(
24+
i: a, # error: [invalid-type-form] "Variable of type `type[int]` is not allowed in a type expression"
25+
j: b, # error: [invalid-type-form]
26+
k: c, # error: [invalid-type-form]
27+
l: d, # error: [invalid-type-form]
28+
m: e, # error: [invalid-type-form]
29+
n: f, # error: [invalid-type-form]
30+
o: g, # error: [invalid-type-form]
31+
p: h, # error: [invalid-type-form]
32+
q: typing, # error: [invalid-type-form]
33+
r: foo, # error: [invalid-type-form]
34+
):
35+
reveal_type(i) # revealed: Unknown
36+
reveal_type(j) # revealed: Unknown
37+
reveal_type(k) # revealed: Unknown
38+
reveal_type(l) # revealed: Unknown
39+
reveal_type(m) # revealed: Unknown
40+
reveal_type(n) # revealed: Unknown
41+
reveal_type(o) # revealed: Unknown
42+
reveal_type(p) # revealed: Unknown
43+
reveal_type(q) # revealed: Unknown
44+
reveal_type(r) # revealed: Unknown
45+
```

crates/red_knot_python_semantic/resources/mdtest/annotations/unsupported_special_forms.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def f(*args: Unpack[Ts]) -> tuple[Unpack[Ts]]:
1818
# TODO: should understand the annotation
1919
reveal_type(args) # revealed: tuple
2020

21-
reveal_type(Alias) # revealed: @Todo(Unsupported or invalid type in a type expression)
21+
reveal_type(Alias) # revealed: @Todo(Invalid or unsupported `KnownInstanceType` in `Type::to_type_expression`)
2222

2323
def g() -> TypeGuard[int]: ...
2424
def h() -> TypeIs[int]: ...
@@ -33,7 +33,7 @@ def i(callback: Callable[Concatenate[int, P], R_co], *args: P.args, **kwargs: P.
3333

3434
class Foo:
3535
def method(self, x: Self):
36-
reveal_type(x) # revealed: @Todo(Unsupported or invalid type in a type expression)
36+
reveal_type(x) # revealed: @Todo(Invalid or unsupported `KnownInstanceType` in `Type::to_type_expression`)
3737
```
3838

3939
## Inheritance

crates/red_knot_python_semantic/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub use semantic_model::{HasType, SemanticModel};
1414
pub mod ast_node_ref;
1515
mod db;
1616
pub mod lint;
17+
pub(crate) mod list;
1718
mod module_name;
1819
mod module_resolver;
1920
mod node_key;

0 commit comments

Comments
 (0)