Skip to content

Commit 9d88226

Browse files
committed
test: update snapshot
Signed-off-by: 11happy <soni5happy@gmail.com>
1 parent 5d92443 commit 9d88226

13 files changed

+243
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: cannot use an asynchronous comprehension inside of a synchronous comprehension on Python 3.10 (syntax was added in 3.11)
5+
--> resources/test/fixtures/semantic_errors/async_comprehension_outside_async_function.py:1:27
6+
|
7+
1 | async def f(): return [[x async for x in foo(n)] for n in range(3)]
8+
| ^^^^^^^^^^^^^^^^^^^^^
9+
2 |
10+
3 | async def test(): return [[x async for x in elements(n)] async for n in range(3)]
11+
|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: attribute name `x` repeated in class pattern
5+
--> resources/test/fixtures/semantic_errors/duplicate_match_class_attribute.py:2:21
6+
|
7+
1 | match x:
8+
2 | case Point(x=1, x=2):
9+
| ^
10+
3 | pass
11+
|
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: mapping pattern checks duplicate key `'key'`
5+
--> resources/test/fixtures/semantic_errors/duplicate_match_key.py:2:21
6+
|
7+
1 | match x:
8+
2 | case {'key': 1, 'key': 2}:
9+
| ^^^^^
10+
3 | pass
11+
|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: duplicate type parameter
5+
--> resources/test/fixtures/semantic_errors/duplicate_type_parameter.py:1:12
6+
|
7+
1 | class C[T, T]: pass
8+
| ^
9+
|
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: yield expression cannot be used within a TypeVar bound
5+
--> resources/test/fixtures/semantic_errors/invalid_expression.py:1:12
6+
|
7+
1 | type X[T: (yield 1)] = int
8+
| ^^^^^^^
9+
2 |
10+
3 | type Y = (yield 1)
11+
|
12+
13+
invalid-syntax: yield expression cannot be used within a type alias
14+
--> resources/test/fixtures/semantic_errors/invalid_expression.py:3:11
15+
|
16+
1 | type X[T: (yield 1)] = int
17+
2 |
18+
3 | type Y = (yield 1)
19+
| ^^^^^^^
20+
4 |
21+
5 | def f[T](x: int) -> (y := 3): return x
22+
|
23+
24+
invalid-syntax: named expression cannot be used within a generic definition
25+
--> resources/test/fixtures/semantic_errors/invalid_expression.py:5:22
26+
|
27+
3 | type Y = (yield 1)
28+
4 |
29+
5 | def f[T](x: int) -> (y := 3): return x
30+
| ^^^^^^
31+
6 |
32+
7 | class C[T]((yield from [object])):
33+
|
34+
35+
invalid-syntax: yield expression cannot be used within a generic definition
36+
--> resources/test/fixtures/semantic_errors/invalid_expression.py:7:13
37+
|
38+
5 | def f[T](x: int) -> (y := 3): return x
39+
6 |
40+
7 | class C[T]((yield from [object])):
41+
| ^^^^^^^^^^^^^^^^^^^
42+
8 | pass
43+
|
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: Starred expression cannot be used here
5+
--> resources/test/fixtures/semantic_errors/invalid_star_expression.py:2:12
6+
|
7+
1 | def func():
8+
2 | return *x
9+
| ^^
10+
3 |
11+
4 | for *x in range(10):
12+
|
13+
14+
invalid-syntax: Starred expression cannot be used here
15+
--> resources/test/fixtures/semantic_errors/invalid_star_expression.py:4:5
16+
|
17+
2 | return *x
18+
3 |
19+
4 | for *x in range(10):
20+
| ^^
21+
5 | pass
22+
|
23+
24+
invalid-syntax: Starred expression cannot be used here
25+
--> resources/test/fixtures/semantic_errors/invalid_star_expression.py:8:11
26+
|
27+
7 | def func():
28+
8 | yield *x
29+
| ^^
30+
|
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: wildcard makes remaining patterns unreachable
5+
--> resources/test/fixtures/semantic_errors/irrefutable_case_pattern.py:2:10
6+
|
7+
1 | match value:
8+
2 | case _:
9+
| ^
10+
3 | pass
11+
4 | case 1:
12+
|
13+
14+
invalid-syntax: name capture `irrefutable` makes remaining patterns unreachable
15+
--> resources/test/fixtures/semantic_errors/irrefutable_case_pattern.py:8:10
16+
|
17+
7 | match value:
18+
8 | case irrefutable:
19+
| ^^^^^^^^^^^
20+
9 | pass
21+
10 | case 1:
22+
|
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: multiple assignments to name `a` in pattern
5+
--> resources/test/fixtures/semantic_errors/multiple_case_assignment.py:2:14
6+
|
7+
1 | match x:
8+
2 | case [a, a]:
9+
| ^
10+
3 | pass
11+
4 | case _:
12+
|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
source: crates/ruff_linter/src/linter.rs
3+
---
4+
invalid-syntax: assignment expression cannot rebind comprehension variable
5+
--> resources/test/fixtures/semantic_errors/rebound_comprehension.py:1:2
6+
|
7+
1 | [x:= 2 for x in range(2)]
8+
| ^
9+
|

0 commit comments

Comments
 (0)