mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-19 20:24:27 +00:00
Consistently wrap tokens in parser diagnostics in backticks instead of 'quotes' (#21163)
The parser currently uses single quotes to wrap tokens. This is inconsistent with the rest of ruff/ty, which use backticks. For example, see the inconsistent diagnostics produced in this simple example: https://play.ty.dev/0a9d6eab-6599-4a1d-8e40-032091f7f50f Consistently wrapping tokens in backticks produces uniform diagnostics. Following the style decision of #723, in #2889 some quotes were already switched into backticks. This is also in line with Rust's guide on diagnostics (https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure): > When code or an identifier must appear in a message or label, it should be surrounded with backticks
This commit is contained in:
parent
bb40c34361
commit
69b4c29924
103 changed files with 359 additions and 359 deletions
|
|
@ -4,4 +4,4 @@ expression: content
|
|||
---
|
||||
syntax_errors.py:
|
||||
1:15 invalid-syntax: Expected one or more symbol names after import
|
||||
3:12 invalid-syntax: Expected ')', found newline
|
||||
3:12 invalid-syntax: Expected `)`, found newline
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:2:7
|
||||
|
|
||||
1 | #: E231
|
||||
|
|
@ -18,7 +18,7 @@ help: Add missing whitespace
|
|||
4 | a[b1,:]
|
||||
5 | #: E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:4:5
|
||||
|
|
||||
2 | a = (1,2)
|
||||
|
|
@ -38,7 +38,7 @@ help: Add missing whitespace
|
|||
6 | a = [{'a':''}]
|
||||
7 | #: Okay
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:6:10
|
||||
|
|
||||
4 | a[b1,:]
|
||||
|
|
@ -58,7 +58,7 @@ help: Add missing whitespace
|
|||
8 | a = (4,)
|
||||
9 | b = (5, )
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:19:10
|
||||
|
|
||||
17 | def foo() -> None:
|
||||
|
|
@ -77,7 +77,7 @@ help: Add missing whitespace
|
|||
21 |
|
||||
22 | #: Okay
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:29:20
|
||||
|
|
||||
27 | mdtypes_template = {
|
||||
|
|
@ -96,7 +96,7 @@ help: Add missing whitespace
|
|||
31 |
|
||||
32 | # E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:33:6
|
||||
|
|
||||
32 | # E231
|
||||
|
|
@ -115,7 +115,7 @@ help: Add missing whitespace
|
|||
35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string
|
||||
36 | f"{a:=1}"
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:47:37
|
||||
|
|
||||
46 | #: E231
|
||||
|
|
@ -134,7 +134,7 @@ help: Add missing whitespace
|
|||
49 | #: Okay
|
||||
50 | a = (1,)
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:60:13
|
||||
|
|
||||
58 | results = {
|
||||
|
|
@ -154,7 +154,7 @@ help: Add missing whitespace
|
|||
62 | results_in_tuple = (
|
||||
63 | {
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:65:17
|
||||
|
|
||||
63 | {
|
||||
|
|
@ -174,7 +174,7 @@ help: Add missing whitespace
|
|||
67 | )
|
||||
68 | results_in_list = [
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:71:17
|
||||
|
|
||||
69 | {
|
||||
|
|
@ -194,7 +194,7 @@ help: Add missing whitespace
|
|||
73 | ]
|
||||
74 | results_in_list_first = [
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:76:17
|
||||
|
|
||||
74 | results_in_list_first = [
|
||||
|
|
@ -214,7 +214,7 @@ help: Add missing whitespace
|
|||
78 | ]
|
||||
79 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:82:13
|
||||
|
|
||||
80 | x = [
|
||||
|
|
@ -234,7 +234,7 @@ help: Add missing whitespace
|
|||
84 | "k3":[2], # E231
|
||||
85 | "k4": [2],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:84:13
|
||||
|
|
||||
82 | "k1":[2], # E231
|
||||
|
|
@ -254,7 +254,7 @@ help: Add missing whitespace
|
|||
86 | "k5": [2],
|
||||
87 | "k6": [1, 2, 3, 4,5,6,7] # E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:87:26
|
||||
|
|
||||
85 | "k4": [2],
|
||||
|
|
@ -274,7 +274,7 @@ help: Add missing whitespace
|
|||
89 | {
|
||||
90 | "k1": [
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:87:28
|
||||
|
|
||||
85 | "k4": [2],
|
||||
|
|
@ -294,7 +294,7 @@ help: Add missing whitespace
|
|||
89 | {
|
||||
90 | "k1": [
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:87:30
|
||||
|
|
||||
85 | "k4": [2],
|
||||
|
|
@ -314,7 +314,7 @@ help: Add missing whitespace
|
|||
89 | {
|
||||
90 | "k1": [
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:92:21
|
||||
|
|
||||
90 | "k1": [
|
||||
|
|
@ -334,7 +334,7 @@ help: Add missing whitespace
|
|||
94 | {
|
||||
95 | "kb": [2,3], # E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:92:24
|
||||
|
|
||||
90 | "k1": [
|
||||
|
|
@ -354,7 +354,7 @@ help: Add missing whitespace
|
|||
94 | {
|
||||
95 | "kb": [2,3], # E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:95:25
|
||||
|
|
||||
93 | },
|
||||
|
|
@ -374,7 +374,7 @@ help: Add missing whitespace
|
|||
97 | {
|
||||
98 | "ka":[2, 3], # E231
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:98:21
|
||||
|
|
||||
96 | },
|
||||
|
|
@ -394,7 +394,7 @@ help: Add missing whitespace
|
|||
100 | "kc": [2, 3], # Ok
|
||||
101 | "kd": [2,3], # E231
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:101:25
|
||||
|
|
||||
99 | "kb": [2, 3], # Ok
|
||||
|
|
@ -414,7 +414,7 @@ help: Add missing whitespace
|
|||
103 | },
|
||||
104 | ]
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:102:21
|
||||
|
|
||||
100 | "kc": [2, 3], # Ok
|
||||
|
|
@ -434,7 +434,7 @@ help: Add missing whitespace
|
|||
104 | ]
|
||||
105 | }
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:102:24
|
||||
|
|
||||
100 | "kc": [2, 3], # Ok
|
||||
|
|
@ -454,7 +454,7 @@ help: Add missing whitespace
|
|||
104 | ]
|
||||
105 | }
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:109:18
|
||||
|
|
||||
108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults
|
||||
|
|
@ -473,7 +473,7 @@ help: Add missing whitespace
|
|||
111 | y:B = [[["foo", "bar"]]],
|
||||
112 | z:object = "fooo",
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:109:40
|
||||
|
|
||||
108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults
|
||||
|
|
@ -492,7 +492,7 @@ help: Add missing whitespace
|
|||
111 | y:B = [[["foo", "bar"]]],
|
||||
112 | z:object = "fooo",
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:109:70
|
||||
|
|
||||
108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults
|
||||
|
|
@ -511,7 +511,7 @@ help: Add missing whitespace
|
|||
111 | y:B = [[["foo", "bar"]]],
|
||||
112 | z:object = "fooo",
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:110:6
|
||||
|
|
||||
108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults
|
||||
|
|
@ -531,7 +531,7 @@ help: Add missing whitespace
|
|||
112 | z:object = "fooo",
|
||||
113 | ):
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:111:6
|
||||
|
|
||||
109 | def pep_696_bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](
|
||||
|
|
@ -551,7 +551,7 @@ help: Add missing whitespace
|
|||
113 | ):
|
||||
114 | pass
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:112:6
|
||||
|
|
||||
110 | x:A = "foo"[::-1],
|
||||
|
|
@ -571,7 +571,7 @@ help: Add missing whitespace
|
|||
114 | pass
|
||||
115 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:116:18
|
||||
|
|
||||
114 | pass
|
||||
|
|
@ -591,7 +591,7 @@ help: Add missing whitespace
|
|||
118 | self,
|
||||
119 | x:A = "foo"[::-1],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:116:40
|
||||
|
|
||||
114 | pass
|
||||
|
|
@ -611,7 +611,7 @@ help: Add missing whitespace
|
|||
118 | self,
|
||||
119 | x:A = "foo"[::-1],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:116:70
|
||||
|
|
||||
114 | pass
|
||||
|
|
@ -631,7 +631,7 @@ help: Add missing whitespace
|
|||
118 | self,
|
||||
119 | x:A = "foo"[::-1],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:117:29
|
||||
|
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
|
|
@ -650,7 +650,7 @@ help: Add missing whitespace
|
|||
119 | x:A = "foo"[::-1],
|
||||
120 | y:B = [[["foo", "bar"]]],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:117:51
|
||||
|
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
|
|
@ -669,7 +669,7 @@ help: Add missing whitespace
|
|||
119 | x:A = "foo"[::-1],
|
||||
120 | y:B = [[["foo", "bar"]]],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:117:81
|
||||
|
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
|
|
@ -688,7 +688,7 @@ help: Add missing whitespace
|
|||
119 | x:A = "foo"[::-1],
|
||||
120 | y:B = [[["foo", "bar"]]],
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:119:10
|
||||
|
|
||||
117 | def pep_696_bad_method[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](
|
||||
|
|
@ -708,7 +708,7 @@ help: Add missing whitespace
|
|||
121 | z:object = "fooo",
|
||||
122 | ):
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:120:10
|
||||
|
|
||||
118 | self,
|
||||
|
|
@ -728,7 +728,7 @@ help: Add missing whitespace
|
|||
122 | ):
|
||||
123 | pass
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:121:10
|
||||
|
|
||||
119 | x:A = "foo"[::-1],
|
||||
|
|
@ -748,7 +748,7 @@ help: Add missing whitespace
|
|||
123 | pass
|
||||
124 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:125:32
|
||||
|
|
||||
123 | pass
|
||||
|
|
@ -768,7 +768,7 @@ help: Add missing whitespace
|
|||
127 | pass
|
||||
128 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:125:54
|
||||
|
|
||||
123 | pass
|
||||
|
|
@ -788,7 +788,7 @@ help: Add missing whitespace
|
|||
127 | pass
|
||||
128 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:125:84
|
||||
|
|
||||
123 | pass
|
||||
|
|
@ -808,7 +808,7 @@ help: Add missing whitespace
|
|||
127 | pass
|
||||
128 |
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:126:47
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
|
|
@ -826,7 +826,7 @@ help: Add missing whitespace
|
|||
128 |
|
||||
129 | # Should be no E231 errors on any of these:
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:126:69
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
|
|
@ -844,7 +844,7 @@ help: Add missing whitespace
|
|||
128 |
|
||||
129 | # Should be no E231 errors on any of these:
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:126:99
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
|
|
@ -862,7 +862,7 @@ help: Add missing whitespace
|
|||
128 |
|
||||
129 | # Should be no E231 errors on any of these:
|
||||
|
||||
E231 [*] Missing whitespace after ','
|
||||
E231 [*] Missing whitespace after `,`
|
||||
--> E23.py:147:6
|
||||
|
|
||||
146 | # E231
|
||||
|
|
@ -881,7 +881,7 @@ help: Add missing whitespace
|
|||
149 | # Okay because it's hard to differentiate between the usages of a colon in a t-string
|
||||
150 | t"{a:=1}"
|
||||
|
||||
E231 [*] Missing whitespace after ':'
|
||||
E231 [*] Missing whitespace after `:`
|
||||
--> E23.py:161:37
|
||||
|
|
||||
160 | #: E231
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
invalid-syntax: Expected ']', found '('
|
||||
invalid-syntax: Expected `]`, found `(`
|
||||
--> E30_syntax_error.py:4:15
|
||||
|
|
||||
2 | # parenthesis.
|
||||
|
|
@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '('
|
|||
5 | pass
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:13:18
|
||||
|
|
||||
12 | class Foo:
|
||||
|
|
@ -32,7 +32,7 @@ E301 Expected 1 blank line, found 0
|
|||
|
|
||||
help: Add missing blank line
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:18:11
|
||||
|
|
||||
16 | pass
|
||||
|
|
@ -41,7 +41,7 @@ invalid-syntax: Expected ')', found newline
|
|||
| ^
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:21:9
|
||||
|
|
||||
21 | def top(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
invalid-syntax: Expected ']', found '('
|
||||
invalid-syntax: Expected `]`, found `(`
|
||||
--> E30_syntax_error.py:4:15
|
||||
|
|
||||
2 | # parenthesis.
|
||||
|
|
@ -22,7 +22,7 @@ E302 Expected 2 blank lines, found 1
|
|||
|
|
||||
help: Add missing blank line(s)
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:13:18
|
||||
|
|
||||
12 | class Foo:
|
||||
|
|
@ -32,7 +32,7 @@ invalid-syntax: Expected ')', found newline
|
|||
15 | def method():
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:18:11
|
||||
|
|
||||
16 | pass
|
||||
|
|
@ -41,7 +41,7 @@ invalid-syntax: Expected ')', found newline
|
|||
| ^
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:21:9
|
||||
|
|
||||
21 | def top(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
invalid-syntax: Expected ']', found '('
|
||||
invalid-syntax: Expected `]`, found `(`
|
||||
--> E30_syntax_error.py:4:15
|
||||
|
|
||||
2 | # parenthesis.
|
||||
|
|
@ -21,7 +21,7 @@ E303 Too many blank lines (3)
|
|||
|
|
||||
help: Remove extraneous blank line(s)
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:13:18
|
||||
|
|
||||
12 | class Foo:
|
||||
|
|
@ -31,7 +31,7 @@ invalid-syntax: Expected ')', found newline
|
|||
15 | def method():
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:18:11
|
||||
|
|
||||
16 | pass
|
||||
|
|
@ -40,7 +40,7 @@ invalid-syntax: Expected ')', found newline
|
|||
| ^
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:21:9
|
||||
|
|
||||
21 | def top(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
invalid-syntax: Expected ']', found '('
|
||||
invalid-syntax: Expected `]`, found `(`
|
||||
--> E30_syntax_error.py:4:15
|
||||
|
|
||||
2 | # parenthesis.
|
||||
|
|
@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '('
|
|||
5 | pass
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:13:18
|
||||
|
|
||||
12 | class Foo:
|
||||
|
|
@ -31,7 +31,7 @@ E305 Expected 2 blank lines after class or function definition, found (1)
|
|||
|
|
||||
help: Add missing blank line(s)
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:18:11
|
||||
|
|
||||
16 | pass
|
||||
|
|
@ -40,7 +40,7 @@ invalid-syntax: Expected ')', found newline
|
|||
| ^
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:21:9
|
||||
|
|
||||
21 | def top(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
invalid-syntax: Expected ']', found '('
|
||||
invalid-syntax: Expected `]`, found `(`
|
||||
--> E30_syntax_error.py:4:15
|
||||
|
|
||||
2 | # parenthesis.
|
||||
|
|
@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '('
|
|||
5 | pass
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:13:18
|
||||
|
|
||||
12 | class Foo:
|
||||
|
|
@ -21,7 +21,7 @@ invalid-syntax: Expected ')', found newline
|
|||
15 | def method():
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:18:11
|
||||
|
|
||||
16 | pass
|
||||
|
|
@ -30,7 +30,7 @@ invalid-syntax: Expected ')', found newline
|
|||
| ^
|
||||
|
|
||||
|
||||
invalid-syntax: Expected ')', found newline
|
||||
invalid-syntax: Expected `)`, found newline
|
||||
--> E30_syntax_error.py:21:9
|
||||
|
|
||||
21 | def top(
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ pub enum InterpolatedStringErrorType {
|
|||
impl std::fmt::Display for InterpolatedStringErrorType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::UnclosedLbrace => write!(f, "expecting '}}'"),
|
||||
Self::UnclosedLbrace => write!(f, "expecting `}}`"),
|
||||
Self::InvalidConversionFlag => write!(f, "invalid conversion character"),
|
||||
Self::SingleRbrace => write!(f, "single '}}' is not allowed"),
|
||||
Self::SingleRbrace => write!(f, "single `}}` is not allowed"),
|
||||
Self::UnterminatedString => write!(f, "unterminated string"),
|
||||
Self::UnterminatedTripleQuotedString => write!(f, "unterminated triple-quoted string"),
|
||||
Self::LambdaWithoutParentheses => {
|
||||
|
|
@ -232,7 +232,7 @@ impl std::fmt::Display for ParseErrorType {
|
|||
ParseErrorType::UnexpectedTokenAfterAsync(kind) => {
|
||||
write!(
|
||||
f,
|
||||
"Expected 'def', 'with' or 'for' to follow 'async', found {kind}",
|
||||
"Expected `def`, `with` or `for` to follow `async`, found {kind}",
|
||||
)
|
||||
}
|
||||
ParseErrorType::InvalidArgumentUnpackingOrder => {
|
||||
|
|
@ -286,10 +286,10 @@ impl std::fmt::Display for ParseErrorType {
|
|||
f.write_str("Parameter without a default cannot follow a parameter with a default")
|
||||
}
|
||||
ParseErrorType::ExpectedKeywordParam => {
|
||||
f.write_str("Expected one or more keyword parameter after '*' separator")
|
||||
f.write_str("Expected one or more keyword parameter after `*` separator")
|
||||
}
|
||||
ParseErrorType::VarParameterWithDefault => {
|
||||
f.write_str("Parameter with '*' or '**' cannot have default value")
|
||||
f.write_str("Parameter with `*` or `**` cannot have default value")
|
||||
}
|
||||
ParseErrorType::InvalidStarPatternUsage => {
|
||||
f.write_str("Star pattern cannot be used here")
|
||||
|
|
|
|||
|
|
@ -635,93 +635,93 @@ impl fmt::Display for TokenKind {
|
|||
TokenKind::TStringEnd => "TStringEnd",
|
||||
TokenKind::IpyEscapeCommand => "IPython escape command",
|
||||
TokenKind::Comment => "comment",
|
||||
TokenKind::Question => "'?'",
|
||||
TokenKind::Exclamation => "'!'",
|
||||
TokenKind::Lpar => "'('",
|
||||
TokenKind::Rpar => "')'",
|
||||
TokenKind::Lsqb => "'['",
|
||||
TokenKind::Rsqb => "']'",
|
||||
TokenKind::Lbrace => "'{'",
|
||||
TokenKind::Rbrace => "'}'",
|
||||
TokenKind::Equal => "'='",
|
||||
TokenKind::ColonEqual => "':='",
|
||||
TokenKind::Dot => "'.'",
|
||||
TokenKind::Colon => "':'",
|
||||
TokenKind::Semi => "';'",
|
||||
TokenKind::Comma => "','",
|
||||
TokenKind::Rarrow => "'->'",
|
||||
TokenKind::Plus => "'+'",
|
||||
TokenKind::Minus => "'-'",
|
||||
TokenKind::Star => "'*'",
|
||||
TokenKind::DoubleStar => "'**'",
|
||||
TokenKind::Slash => "'/'",
|
||||
TokenKind::DoubleSlash => "'//'",
|
||||
TokenKind::Percent => "'%'",
|
||||
TokenKind::Vbar => "'|'",
|
||||
TokenKind::Amper => "'&'",
|
||||
TokenKind::CircumFlex => "'^'",
|
||||
TokenKind::LeftShift => "'<<'",
|
||||
TokenKind::RightShift => "'>>'",
|
||||
TokenKind::Tilde => "'~'",
|
||||
TokenKind::At => "'@'",
|
||||
TokenKind::Less => "'<'",
|
||||
TokenKind::Greater => "'>'",
|
||||
TokenKind::EqEqual => "'=='",
|
||||
TokenKind::NotEqual => "'!='",
|
||||
TokenKind::LessEqual => "'<='",
|
||||
TokenKind::GreaterEqual => "'>='",
|
||||
TokenKind::PlusEqual => "'+='",
|
||||
TokenKind::MinusEqual => "'-='",
|
||||
TokenKind::StarEqual => "'*='",
|
||||
TokenKind::DoubleStarEqual => "'**='",
|
||||
TokenKind::SlashEqual => "'/='",
|
||||
TokenKind::DoubleSlashEqual => "'//='",
|
||||
TokenKind::PercentEqual => "'%='",
|
||||
TokenKind::VbarEqual => "'|='",
|
||||
TokenKind::AmperEqual => "'&='",
|
||||
TokenKind::CircumflexEqual => "'^='",
|
||||
TokenKind::LeftShiftEqual => "'<<='",
|
||||
TokenKind::RightShiftEqual => "'>>='",
|
||||
TokenKind::AtEqual => "'@='",
|
||||
TokenKind::Ellipsis => "'...'",
|
||||
TokenKind::False => "'False'",
|
||||
TokenKind::None => "'None'",
|
||||
TokenKind::True => "'True'",
|
||||
TokenKind::And => "'and'",
|
||||
TokenKind::As => "'as'",
|
||||
TokenKind::Assert => "'assert'",
|
||||
TokenKind::Async => "'async'",
|
||||
TokenKind::Await => "'await'",
|
||||
TokenKind::Break => "'break'",
|
||||
TokenKind::Class => "'class'",
|
||||
TokenKind::Continue => "'continue'",
|
||||
TokenKind::Def => "'def'",
|
||||
TokenKind::Del => "'del'",
|
||||
TokenKind::Elif => "'elif'",
|
||||
TokenKind::Else => "'else'",
|
||||
TokenKind::Except => "'except'",
|
||||
TokenKind::Finally => "'finally'",
|
||||
TokenKind::For => "'for'",
|
||||
TokenKind::From => "'from'",
|
||||
TokenKind::Global => "'global'",
|
||||
TokenKind::If => "'if'",
|
||||
TokenKind::Import => "'import'",
|
||||
TokenKind::In => "'in'",
|
||||
TokenKind::Is => "'is'",
|
||||
TokenKind::Lambda => "'lambda'",
|
||||
TokenKind::Nonlocal => "'nonlocal'",
|
||||
TokenKind::Not => "'not'",
|
||||
TokenKind::Or => "'or'",
|
||||
TokenKind::Pass => "'pass'",
|
||||
TokenKind::Raise => "'raise'",
|
||||
TokenKind::Return => "'return'",
|
||||
TokenKind::Try => "'try'",
|
||||
TokenKind::While => "'while'",
|
||||
TokenKind::Match => "'match'",
|
||||
TokenKind::Type => "'type'",
|
||||
TokenKind::Case => "'case'",
|
||||
TokenKind::With => "'with'",
|
||||
TokenKind::Yield => "'yield'",
|
||||
TokenKind::Question => "`?`",
|
||||
TokenKind::Exclamation => "`!`",
|
||||
TokenKind::Lpar => "`(`",
|
||||
TokenKind::Rpar => "`)`",
|
||||
TokenKind::Lsqb => "`[`",
|
||||
TokenKind::Rsqb => "`]`",
|
||||
TokenKind::Lbrace => "`{`",
|
||||
TokenKind::Rbrace => "`}`",
|
||||
TokenKind::Equal => "`=`",
|
||||
TokenKind::ColonEqual => "`:=`",
|
||||
TokenKind::Dot => "`.`",
|
||||
TokenKind::Colon => "`:`",
|
||||
TokenKind::Semi => "`;`",
|
||||
TokenKind::Comma => "`,`",
|
||||
TokenKind::Rarrow => "`->`",
|
||||
TokenKind::Plus => "`+`",
|
||||
TokenKind::Minus => "`-`",
|
||||
TokenKind::Star => "`*`",
|
||||
TokenKind::DoubleStar => "`**`",
|
||||
TokenKind::Slash => "`/`",
|
||||
TokenKind::DoubleSlash => "`//`",
|
||||
TokenKind::Percent => "`%`",
|
||||
TokenKind::Vbar => "`|`",
|
||||
TokenKind::Amper => "`&`",
|
||||
TokenKind::CircumFlex => "`^`",
|
||||
TokenKind::LeftShift => "`<<`",
|
||||
TokenKind::RightShift => "`>>`",
|
||||
TokenKind::Tilde => "`~`",
|
||||
TokenKind::At => "`@`",
|
||||
TokenKind::Less => "`<`",
|
||||
TokenKind::Greater => "`>`",
|
||||
TokenKind::EqEqual => "`==`",
|
||||
TokenKind::NotEqual => "`!=`",
|
||||
TokenKind::LessEqual => "`<=`",
|
||||
TokenKind::GreaterEqual => "`>=`",
|
||||
TokenKind::PlusEqual => "`+=`",
|
||||
TokenKind::MinusEqual => "`-=`",
|
||||
TokenKind::StarEqual => "`*=`",
|
||||
TokenKind::DoubleStarEqual => "`**=`",
|
||||
TokenKind::SlashEqual => "`/=`",
|
||||
TokenKind::DoubleSlashEqual => "`//=`",
|
||||
TokenKind::PercentEqual => "`%=`",
|
||||
TokenKind::VbarEqual => "`|=`",
|
||||
TokenKind::AmperEqual => "`&=`",
|
||||
TokenKind::CircumflexEqual => "`^=`",
|
||||
TokenKind::LeftShiftEqual => "`<<=`",
|
||||
TokenKind::RightShiftEqual => "`>>=`",
|
||||
TokenKind::AtEqual => "`@=`",
|
||||
TokenKind::Ellipsis => "`...`",
|
||||
TokenKind::False => "`False`",
|
||||
TokenKind::None => "`None`",
|
||||
TokenKind::True => "`True`",
|
||||
TokenKind::And => "`and`",
|
||||
TokenKind::As => "`as`",
|
||||
TokenKind::Assert => "`assert`",
|
||||
TokenKind::Async => "`async`",
|
||||
TokenKind::Await => "`await`",
|
||||
TokenKind::Break => "`break`",
|
||||
TokenKind::Class => "`class`",
|
||||
TokenKind::Continue => "`continue`",
|
||||
TokenKind::Def => "`def`",
|
||||
TokenKind::Del => "`del`",
|
||||
TokenKind::Elif => "`elif`",
|
||||
TokenKind::Else => "`else`",
|
||||
TokenKind::Except => "`except`",
|
||||
TokenKind::Finally => "`finally`",
|
||||
TokenKind::For => "`for`",
|
||||
TokenKind::From => "`from`",
|
||||
TokenKind::Global => "`global`",
|
||||
TokenKind::If => "`if`",
|
||||
TokenKind::Import => "`import`",
|
||||
TokenKind::In => "`in`",
|
||||
TokenKind::Is => "`is`",
|
||||
TokenKind::Lambda => "`lambda`",
|
||||
TokenKind::Nonlocal => "`nonlocal`",
|
||||
TokenKind::Not => "`not`",
|
||||
TokenKind::Or => "`or`",
|
||||
TokenKind::Pass => "`pass`",
|
||||
TokenKind::Raise => "`raise`",
|
||||
TokenKind::Return => "`return`",
|
||||
TokenKind::Try => "`try`",
|
||||
TokenKind::While => "`while`",
|
||||
TokenKind::Match => "`match`",
|
||||
TokenKind::Type => "`type`",
|
||||
TokenKind::Case => "`case`",
|
||||
TokenKind::With => "`with`",
|
||||
TokenKind::Yield => "`yield`",
|
||||
};
|
||||
f.write_str(value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ Module(
|
|||
|
|
||||
1 | assert *x
|
||||
2 | assert assert x
|
||||
| ^^^^^^ Syntax Error: Expected an identifier, but found a keyword 'assert' that cannot be used here
|
||||
| ^^^^^^ Syntax Error: Expected an identifier, but found a keyword `assert` that cannot be used here
|
||||
3 | assert yield x
|
||||
4 | assert x := 1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | a = pass = c
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
2 | a + b
|
||||
3 | a = b = pass = c
|
||||
|
|
||||
|
|
@ -158,6 +158,6 @@ Module(
|
|||
1 | a = pass = c
|
||||
2 | a + b
|
||||
3 | a = b = pass = c
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
4 | a + b
|
||||
|
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | async class Foo: ...
|
||||
| ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'class'
|
||||
| ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `class`
|
||||
2 | async while test: ...
|
||||
3 | async x = 1
|
||||
|
|
||||
|
|
@ -190,7 +190,7 @@ Module(
|
|||
|
|
||||
1 | async class Foo: ...
|
||||
2 | async while test: ...
|
||||
| ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'while'
|
||||
| ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `while`
|
||||
3 | async x = 1
|
||||
4 | async async def foo(): ...
|
||||
|
|
||||
|
|
@ -200,7 +200,7 @@ Module(
|
|||
1 | async class Foo: ...
|
||||
2 | async while test: ...
|
||||
3 | async x = 1
|
||||
| ^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found name
|
||||
| ^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found name
|
||||
4 | async async def foo(): ...
|
||||
5 | async match test:
|
||||
|
|
||||
|
|
@ -210,7 +210,7 @@ Module(
|
|||
2 | async while test: ...
|
||||
3 | async x = 1
|
||||
4 | async async def foo(): ...
|
||||
| ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'async'
|
||||
| ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `async`
|
||||
5 | async match test:
|
||||
6 | case _: ...
|
||||
|
|
||||
|
|
@ -220,6 +220,6 @@ Module(
|
|||
3 | async x = 1
|
||||
4 | async async def foo(): ...
|
||||
5 | async match test:
|
||||
| ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'match'
|
||||
| ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `match`
|
||||
6 | case _: ...
|
||||
|
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ Module(
|
|||
3 | *x += 1
|
||||
4 | pass += 1
|
||||
5 | x += pass
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
6 | (x + y) += 1
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | class Foo[T1, *T2(a, b):
|
||||
| ^ Syntax Error: Expected ']', found '('
|
||||
| ^ Syntax Error: Expected `]`, found `(`
|
||||
2 | pass
|
||||
3 | x = 10
|
||||
|
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(**x := 1)
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,5 +61,5 @@ Module(
|
|||
|
|
||||
1 | # The comma between the first two elements is expected in `parse_list_expression`.
|
||||
2 | [0, 1 2]
|
||||
| ^ Syntax Error: Expected ',', found int
|
||||
| ^ Syntax Error: Expected `,`, found int
|
||||
|
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | (async)
|
||||
| ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'async' that cannot be used here
|
||||
| ^^^^^ Syntax Error: Expected an identifier, but found a keyword `async` that cannot be used here
|
||||
2 | (x async x in iter)
|
||||
|
|
||||
|
||||
|
|
@ -85,5 +85,5 @@ Module(
|
|||
|
|
||||
1 | (async)
|
||||
2 | (x async x in iter)
|
||||
| ^ Syntax Error: Expected 'for', found name
|
||||
| ^ Syntax Error: Expected `for`, found name
|
||||
|
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | @def foo(): ...
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here
|
||||
2 | @
|
||||
3 | def foo(): ...
|
||||
|
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | @x def foo(): ...
|
||||
| ^^^ Syntax Error: Expected newline, found 'def'
|
||||
| ^^^ Syntax Error: Expected newline, found `def`
|
||||
2 | @x async def foo(): ...
|
||||
3 | @x class Foo: ...
|
||||
|
|
||||
|
|
@ -170,7 +170,7 @@ Module(
|
|||
|
|
||||
1 | @x def foo(): ...
|
||||
2 | @x async def foo(): ...
|
||||
| ^^^^^ Syntax Error: Expected newline, found 'async'
|
||||
| ^^^^^ Syntax Error: Expected newline, found `async`
|
||||
3 | @x class Foo: ...
|
||||
|
|
||||
|
||||
|
|
@ -179,5 +179,5 @@ Module(
|
|||
1 | @x def foo(): ...
|
||||
2 | @x async def foo(): ...
|
||||
3 | @x class Foo: ...
|
||||
| ^^^^^ Syntax Error: Expected newline, found 'class'
|
||||
| ^^^^^ Syntax Error: Expected newline, found `class`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ Module(
|
|||
3 | call(***x)
|
||||
4 |
|
||||
5 | call(**x := 1)
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,5 +61,5 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(x y)
|
||||
| ^ Syntax Error: Expected ',', found name
|
||||
| ^ Syntax Error: Expected `,`, found name
|
||||
|
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 |
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(x
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 |
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(x,
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 |
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ Module(
|
|||
|
|
||||
6 | # Same here as well, `not` without `in` is considered to be a unary operator
|
||||
7 | x not is y
|
||||
| ^^ Syntax Error: Expected an identifier, but found a keyword 'is' that cannot be used here
|
||||
| ^^ Syntax Error: Expected an identifier, but found a keyword `is` that cannot be used here
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ Module(
|
|||
2 | # the ones which are higher than that.
|
||||
3 |
|
||||
4 | {**x := 1}
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
5 | {a: 1, **x if True else y}
|
||||
6 | {**lambda x: x, b: 2}
|
||||
|
|
||||
|
|
@ -554,7 +554,7 @@ Module(
|
|||
2 | # the ones which are higher than that.
|
||||
3 |
|
||||
4 | {**x := 1}
|
||||
| ^ Syntax Error: Expected ':', found '}'
|
||||
| ^ Syntax Error: Expected `:`, found `}`
|
||||
5 | {a: 1, **x if True else y}
|
||||
6 | {**lambda x: x, b: 2}
|
||||
|
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ Module(
|
|||
2 | # it's actually a comprehension.
|
||||
3 |
|
||||
4 | {**x: y for x, y in data}
|
||||
| ^^^ Syntax Error: Expected ':', found 'for'
|
||||
| ^^^ Syntax Error: Expected `:`, found `for`
|
||||
5 |
|
||||
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
||||
|
|
||||
|
|
@ -144,7 +144,7 @@ Module(
|
|||
2 | # it's actually a comprehension.
|
||||
3 |
|
||||
4 | {**x: y for x, y in data}
|
||||
| ^ Syntax Error: Expected ',', found name
|
||||
| ^ Syntax Error: Expected `,`, found name
|
||||
5 |
|
||||
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
||||
|
|
||||
|
|
@ -154,7 +154,7 @@ Module(
|
|||
2 | # it's actually a comprehension.
|
||||
3 |
|
||||
4 | {**x: y for x, y in data}
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
5 |
|
||||
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
||||
|
|
||||
|
|
@ -164,7 +164,7 @@ Module(
|
|||
2 | # it's actually a comprehension.
|
||||
3 |
|
||||
4 | {**x: y for x, y in data}
|
||||
| ^ Syntax Error: Expected ':', found '}'
|
||||
| ^ Syntax Error: Expected `:`, found `}`
|
||||
5 |
|
||||
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Module(
|
|||
1 | {x:
|
||||
2 |
|
||||
3 | def foo():
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here
|
||||
4 | pass
|
||||
|
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ Module(
|
|||
1 | {x:
|
||||
2 |
|
||||
3 | def foo():
|
||||
| ^^^ Syntax Error: Expected ',', found name
|
||||
| ^^^ Syntax Error: Expected `,`, found name
|
||||
4 | pass
|
||||
|
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ Module(
|
|||
|
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | {x: 1,
|
||||
| ^ Syntax Error: Expected '}', found newline
|
||||
| ^ Syntax Error: Expected `}`, found newline
|
||||
2 |
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ Module(
|
|||
1 | # Unparenthesized named expression not allowed in key
|
||||
2 |
|
||||
3 | {x := 1: y, z := 2: a}
|
||||
| ^^ Syntax Error: Expected ':', found ':='
|
||||
| ^^ Syntax Error: Expected `:`, found `:=`
|
||||
4 |
|
||||
5 | x + y
|
||||
|
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ Module(
|
|||
1 | # Unparenthesized named expression not allowed in value
|
||||
2 |
|
||||
3 | {x: y := 1, z: a := 2}
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
4 |
|
||||
5 | x + y
|
||||
|
|
||||
|
|
@ -155,7 +155,7 @@ Module(
|
|||
1 | # Unparenthesized named expression not allowed in value
|
||||
2 |
|
||||
3 | {x: y := 1, z: a := 2}
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
4 |
|
||||
5 | x + y
|
||||
|
|
||||
|
|
@ -165,7 +165,7 @@ Module(
|
|||
1 | # Unparenthesized named expression not allowed in value
|
||||
2 |
|
||||
3 | {x: y := 1, z: a := 2}
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
4 |
|
||||
5 | x + y
|
||||
|
|
||||
|
|
@ -175,7 +175,7 @@ Module(
|
|||
1 | # Unparenthesized named expression not allowed in value
|
||||
2 |
|
||||
3 | {x: y := 1, z: a := 2}
|
||||
| ^ Syntax Error: Expected ':', found '}'
|
||||
| ^ Syntax Error: Expected `:`, found `}`
|
||||
4 |
|
||||
5 | x + y
|
||||
|
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ Module(
|
|||
|
|
||||
9 | # Missing comma
|
||||
10 | {1: 2 3: 4}
|
||||
| ^ Syntax Error: Expected ',', found int
|
||||
| ^ Syntax Error: Expected `,`, found int
|
||||
11 |
|
||||
12 | # No value
|
||||
|
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ Module(
|
|||
7 | lambda a, *a: 1
|
||||
8 |
|
||||
9 | lambda a, *, **a: 1
|
||||
| ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^^^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Module(
|
|||
2 | # token starts a statement.
|
||||
3 |
|
||||
4 | [1, 2
|
||||
| ^ Syntax Error: Expected ']', found newline
|
||||
| ^ Syntax Error: Expected `]`, found newline
|
||||
5 |
|
||||
6 | def foo():
|
||||
7 | pass
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ Module(
|
|||
|
|
||||
9 | # Missing comma
|
||||
10 | [1 2]
|
||||
| ^ Syntax Error: Expected ',', found int
|
||||
| ^ Syntax Error: Expected `,`, found int
|
||||
11 |
|
||||
12 | # Dictionary element in a list
|
||||
|
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ Module(
|
|||
3 | (x :=
|
||||
4 |
|
||||
5 | def foo():
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here
|
||||
6 | pass
|
||||
|
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ Module(
|
|||
3 | (x :=
|
||||
4 |
|
||||
5 | def foo():
|
||||
| ^^^ Syntax Error: Expected ')', found name
|
||||
| ^^^ Syntax Error: Expected `)`, found name
|
||||
6 | pass
|
||||
|
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ Module(
|
|||
|
|
||||
5 | def foo():
|
||||
6 | pass
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -142,14 +142,14 @@ Module(
|
|||
|
|
||||
1 | (*x for x in y)
|
||||
2 | (x := 1, for x in y)
|
||||
| ^^^ Syntax Error: Expected ')', found 'for'
|
||||
| ^^^ Syntax Error: Expected `)`, found `for`
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | (*x for x in y)
|
||||
2 | (x := 1, for x in y)
|
||||
| ^ Syntax Error: Expected ':', found ')'
|
||||
| ^ Syntax Error: Expected `:`, found `)`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Module(
|
|||
2 | # token starts a statement.
|
||||
3 |
|
||||
4 | (1, 2
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
5 |
|
||||
6 | def foo():
|
||||
7 | pass
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ Module(
|
|||
|
|
||||
9 | # Missing comma
|
||||
10 | (1 2)
|
||||
| ^ Syntax Error: Expected ')', found int
|
||||
| ^ Syntax Error: Expected `)`, found int
|
||||
11 |
|
||||
12 | # Dictionary element in a list
|
||||
|
|
||||
|
|
@ -343,7 +343,7 @@ Module(
|
|||
|
|
||||
12 | # Dictionary element in a list
|
||||
13 | (1: 2)
|
||||
| ^ Syntax Error: Expected ')', found ':'
|
||||
| ^ Syntax Error: Expected `)`, found `:`
|
||||
14 |
|
||||
15 | # Missing expression
|
||||
|
|
||||
|
|
@ -390,7 +390,7 @@ Module(
|
|||
16 | (1, x + )
|
||||
17 |
|
||||
18 | (1; 2)
|
||||
| ^ Syntax Error: Expected ')', found ';'
|
||||
| ^ Syntax Error: Expected `)`, found `;`
|
||||
19 |
|
||||
20 | # Unparenthesized named expression is not allowed
|
||||
|
|
||||
|
|
@ -420,5 +420,5 @@ Module(
|
|||
|
|
||||
20 | # Unparenthesized named expression is not allowed
|
||||
21 | x, y := 2, z
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1542,5 +1542,5 @@ Module(
|
|||
18 | *x if True else y, z, *x if True else y
|
||||
19 | *lambda x: x, z, *lambda x: x
|
||||
20 | *x := 2, z, *x := 2
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ Module(
|
|||
2 | # token starts a statement.
|
||||
3 |
|
||||
4 | {1, 2
|
||||
| ^ Syntax Error: Expected '}', found newline
|
||||
| ^ Syntax Error: Expected `}`, found newline
|
||||
5 |
|
||||
6 | def foo():
|
||||
7 | pass
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ Module(
|
|||
|
|
||||
11 | # Missing comma
|
||||
12 | {1 2}
|
||||
| ^ Syntax Error: Expected ',', found int
|
||||
| ^ Syntax Error: Expected `,`, found int
|
||||
13 |
|
||||
14 | # Dictionary element in a list
|
||||
|
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ Module(
|
|||
1 | x[::
|
||||
2 |
|
||||
3 | def foo():
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here
|
||||
| ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here
|
||||
4 | pass
|
||||
|
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ Module(
|
|||
1 | x[::
|
||||
2 |
|
||||
3 | def foo():
|
||||
| ^^^ Syntax Error: Expected ']', found name
|
||||
| ^^^ Syntax Error: Expected `]`, found name
|
||||
4 | pass
|
||||
|
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ Module(
|
|||
|
|
||||
3 | def foo():
|
||||
4 | pass
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here
|
||||
| ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -125,5 +125,5 @@ Module(
|
|||
2 | yield x := 1
|
||||
3 |
|
||||
4 | yield 1, x := 2, 3
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | f"{lambda x: x}"
|
||||
| ^^ Syntax Error: f-string: expecting '}'
|
||||
| ^^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ Module(
|
|||
|
|
||||
1 | f"{"
|
||||
2 | f"{foo!r"
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
3 | f"{foo="
|
||||
4 | f"{"
|
||||
|
|
||||
|
|
@ -277,7 +277,7 @@ Module(
|
|||
1 | f"{"
|
||||
2 | f"{foo!r"
|
||||
3 | f"{foo="
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
4 | f"{"
|
||||
5 | f"""{"""
|
||||
|
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | f"hello {x:"
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
2 | f"hello {x:.3f"
|
||||
|
|
||||
|
||||
|
|
@ -154,5 +154,5 @@ Module(
|
|||
|
|
||||
1 | f"hello {x:"
|
||||
2 | f"hello {x:.3f"
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ Module(
|
|||
1 | for x in *a and b: ...
|
||||
2 | for x in yield a: ...
|
||||
3 | for target in x := 1: ...
|
||||
| ^^ Syntax Error: Expected ':', found ':='
|
||||
| ^^ Syntax Error: Expected `:`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ Module(
|
|||
4 | for *x | y in z: ...
|
||||
5 | for await x in z: ...
|
||||
6 | for yield x in y: ...
|
||||
| ^ Syntax Error: Expected 'in', found ':'
|
||||
| ^ Syntax Error: Expected `in`, found `:`
|
||||
7 | for [x, 1, y, *["a"]] in z: ...
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | for a b: ...
|
||||
| ^ Syntax Error: Expected 'in', found name
|
||||
| ^ Syntax Error: Expected `in`, found name
|
||||
2 | for a: ...
|
||||
|
|
||||
|
||||
|
|
@ -102,5 +102,5 @@ Module(
|
|||
|
|
||||
1 | for a b: ...
|
||||
2 | for a: ...
|
||||
| ^ Syntax Error: Expected 'in', found ':'
|
||||
| ^ Syntax Error: Expected `in`, found `:`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ Module(
|
|||
|
||||
|
|
||||
1 | for in x: ...
|
||||
| ^^ Syntax Error: Expected an identifier, but found a keyword 'in' that cannot be used here
|
||||
| ^^ Syntax Error: Expected an identifier, but found a keyword `in` that cannot be used here
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | for in x: ...
|
||||
| ^ Syntax Error: Expected 'in', found name
|
||||
| ^ Syntax Error: Expected `in`, found name
|
||||
|
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | from x import a.
|
||||
| ^ Syntax Error: Expected ',', found '.'
|
||||
| ^ Syntax Error: Expected `,`, found `.`
|
||||
2 | from x import a.b
|
||||
3 | from x import a, b.c, d, e.f, g
|
||||
|
|
||||
|
|
@ -175,7 +175,7 @@ Module(
|
|||
|
|
||||
1 | from x import a.
|
||||
2 | from x import a.b
|
||||
| ^ Syntax Error: Expected ',', found '.'
|
||||
| ^ Syntax Error: Expected `,`, found `.`
|
||||
3 | from x import a, b.c, d, e.f, g
|
||||
|
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ Module(
|
|||
1 | from x import a.
|
||||
2 | from x import a.b
|
||||
3 | from x import a, b.c, d, e.f, g
|
||||
| ^ Syntax Error: Expected ',', found '.'
|
||||
| ^ Syntax Error: Expected `,`, found `.`
|
||||
|
|
||||
|
||||
|
||||
|
|
@ -192,5 +192,5 @@ Module(
|
|||
1 | from x import a.
|
||||
2 | from x import a.b
|
||||
3 | from x import a, b.c, d, e.f, g
|
||||
| ^ Syntax Error: Expected ',', found '.'
|
||||
| ^ Syntax Error: Expected `,`, found `.`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | from x import (a, b
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 | 1 + 1
|
||||
3 | from x import (a, b,
|
||||
4 | 2 + 2
|
||||
|
|
@ -163,6 +163,6 @@ Module(
|
|||
1 | from x import (a, b
|
||||
2 | 1 + 1
|
||||
3 | from x import (a, b,
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
4 | 2 + 2
|
||||
|
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo(a: int, b:
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 | def foo():
|
||||
3 | return 42
|
||||
4 | def foo(a: int, b: str
|
||||
|
|
@ -254,7 +254,7 @@ Module(
|
|||
3 | return 42
|
||||
4 | def foo(a: int, b: str
|
||||
5 | x = 10
|
||||
| ^ Syntax Error: Expected ',', found name
|
||||
| ^ Syntax Error: Expected `,`, found name
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo[T1, *T2(a, b):
|
||||
| ^ Syntax Error: Expected ']', found '('
|
||||
| ^ Syntax Error: Expected `]`, found `(`
|
||||
2 | return a + b
|
||||
3 | x = 10
|
||||
|
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ Module(
|
|||
1 | if x:
|
||||
2 | pass
|
||||
3 | elif y
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
4 | pass
|
||||
5 | else:
|
||||
6 | pass
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | if x
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
2 | if x
|
||||
3 | pass
|
||||
4 | a = 1
|
||||
|
|
@ -101,7 +101,7 @@ Module(
|
|||
|
|
||||
1 | if x
|
||||
2 | if x
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
3 | pass
|
||||
4 | a = 1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -80,6 +80,6 @@ Module(
|
|||
|
||||
|
|
||||
1 | match [1, 2]
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
2 | case _: ...
|
||||
|
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | match foo: case _: ...
|
||||
| ^^^^ Syntax Error: Expected newline, found 'case'
|
||||
| ^^^^ Syntax Error: Expected newline, found `case`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | if True: pass elif False: pass else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'elif'
|
||||
| ^^^^ Syntax Error: Expected newline, found `elif`
|
||||
2 | if True: pass; elif False: pass; else: pass
|
||||
3 | for x in iter: break else: pass
|
||||
|
|
||||
|
|
@ -334,7 +334,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | if True: pass elif False: pass else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
2 | if True: pass; elif False: pass; else: pass
|
||||
3 | for x in iter: break else: pass
|
||||
|
|
||||
|
|
@ -343,7 +343,7 @@ Module(
|
|||
|
|
||||
1 | if True: pass elif False: pass else: pass
|
||||
2 | if True: pass; elif False: pass; else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'elif'
|
||||
| ^^^^ Syntax Error: Expected newline, found `elif`
|
||||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
|
|
||||
|
|
@ -352,7 +352,7 @@ Module(
|
|||
|
|
||||
1 | if True: pass elif False: pass else: pass
|
||||
2 | if True: pass; elif False: pass; else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
|
|
||||
|
|
@ -362,7 +362,7 @@ Module(
|
|||
1 | if True: pass elif False: pass else: pass
|
||||
2 | if True: pass; elif False: pass; else: pass
|
||||
3 | for x in iter: break else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
|
|
||||
|
|
@ -372,7 +372,7 @@ Module(
|
|||
2 | if True: pass; elif False: pass; else: pass
|
||||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
|
|
||||
|
|
@ -382,7 +382,7 @@ Module(
|
|||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
| ^^^^^^ Syntax Error: Expected newline, found 'except'
|
||||
| ^^^^^^ Syntax Error: Expected newline, found `except`
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
|
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ Module(
|
|||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
|
|
||||
|
||||
|
|
@ -400,7 +400,7 @@ Module(
|
|||
3 | for x in iter: break else: pass
|
||||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
| ^^^^^^^ Syntax Error: Expected newline, found 'finally'
|
||||
| ^^^^^^^ Syntax Error: Expected newline, found `finally`
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
|
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ Module(
|
|||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
| ^^^^^^ Syntax Error: Expected newline, found 'except'
|
||||
| ^^^^^^ Syntax Error: Expected newline, found `except`
|
||||
|
|
||||
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ Module(
|
|||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
| ^^^^ Syntax Error: Expected newline, found 'else'
|
||||
| ^^^^ Syntax Error: Expected newline, found `else`
|
||||
|
|
||||
|
||||
|
||||
|
|
@ -425,5 +425,5 @@ Module(
|
|||
4 | for x in iter: break; else: pass
|
||||
5 | try: pass except exc: pass else: pass finally: pass
|
||||
6 | try: pass; except exc: pass; else: pass; finally: pass
|
||||
| ^^^^^^^ Syntax Error: Expected newline, found 'finally'
|
||||
| ^^^^^^^ Syntax Error: Expected newline, found `finally`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ Module(
|
|||
1 | # even after 3.9, an unparenthesized named expression is not allowed in a slice
|
||||
2 | lst[x:=1:-1]
|
||||
3 | lst[1:x:=1]
|
||||
| ^^ Syntax Error: Expected ']', found ':='
|
||||
| ^^ Syntax Error: Expected `]`, found `:=`
|
||||
4 | lst[1:3:x:=1]
|
||||
|
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ Module(
|
|||
2 | lst[x:=1:-1]
|
||||
3 | lst[1:x:=1]
|
||||
4 | lst[1:3:x:=1]
|
||||
| ^^ Syntax Error: Expected ']', found ':='
|
||||
| ^^ Syntax Error: Expected `]`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,5 +88,5 @@ Module(
|
|||
|
|
||||
1 | # parse_options: {"target-version": "3.12"}
|
||||
2 | f"{1:""}" # this is a ParseError on all versions
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo # comment
|
||||
| ^ Syntax Error: Expected '(', found newline
|
||||
| ^ Syntax Error: Expected `(`, found newline
|
||||
2 | def bar(): ...
|
||||
3 | def baz
|
||||
|
|
||||
|
|
@ -115,7 +115,7 @@ Module(
|
|||
|
|
||||
1 | def foo # comment
|
||||
2 | def bar(): ...
|
||||
| ^^^ Syntax Error: Expected ')', found 'def'
|
||||
| ^^^ Syntax Error: Expected `)`, found `def`
|
||||
3 | def baz
|
||||
|
|
||||
|
||||
|
|
@ -124,12 +124,12 @@ Module(
|
|||
1 | def foo # comment
|
||||
2 | def bar(): ...
|
||||
3 | def baz
|
||||
| ^ Syntax Error: Expected '(', found newline
|
||||
| ^ Syntax Error: Expected `(`, found newline
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
2 | def bar(): ...
|
||||
3 | def baz
|
||||
| ^ Syntax Error: Expected ')', found end of file
|
||||
| ^ Syntax Error: Expected `)`, found end of file
|
||||
|
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ Module(
|
|||
1 | def foo(arg: *int): ...
|
||||
2 | def foo(arg: yield int): ...
|
||||
3 | def foo(arg: x := int): ...
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo(*): ...
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
2 | def foo(*,): ...
|
||||
3 | def foo(a, *): ...
|
||||
|
|
||||
|
|
@ -260,7 +260,7 @@ Module(
|
|||
|
|
||||
1 | def foo(*): ...
|
||||
2 | def foo(*,): ...
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
3 | def foo(a, *): ...
|
||||
4 | def foo(a, *,): ...
|
||||
|
|
||||
|
|
@ -270,7 +270,7 @@ Module(
|
|||
1 | def foo(*): ...
|
||||
2 | def foo(*,): ...
|
||||
3 | def foo(a, *): ...
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
4 | def foo(a, *,): ...
|
||||
5 | def foo(*, **kwargs): ...
|
||||
|
|
||||
|
|
@ -280,7 +280,7 @@ Module(
|
|||
2 | def foo(*,): ...
|
||||
3 | def foo(a, *): ...
|
||||
4 | def foo(a, *,): ...
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
5 | def foo(*, **kwargs): ...
|
||||
|
|
||||
|
||||
|
|
@ -289,5 +289,5 @@ Module(
|
|||
3 | def foo(a, *): ...
|
||||
4 | def foo(a, *,): ...
|
||||
5 | def foo(*, **kwargs): ...
|
||||
| ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
|
|
||||
|
|
|
|||
|
|
@ -67,5 +67,5 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo(*, **kwargs): ...
|
||||
| ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
| ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after `*` separator
|
||||
|
|
||||
|
|
|
|||
|
|
@ -165,19 +165,19 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ...
|
||||
| ^ Syntax Error: Parameter with '*' or '**' cannot have default value
|
||||
| ^ Syntax Error: Parameter with `*` or `**` cannot have default value
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ...
|
||||
| ^ Syntax Error: Expected ')', found '{'
|
||||
| ^ Syntax Error: Expected `)`, found `{`
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ...
|
||||
| ^ Syntax Error: Expected newline, found ')'
|
||||
| ^ Syntax Error: Expected newline, found `)`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -117,19 +117,19 @@ Module(
|
|||
|
||||
|
|
||||
1 | def foo(a, *args=(1, 2)): ...
|
||||
| ^ Syntax Error: Parameter with '*' or '**' cannot have default value
|
||||
| ^ Syntax Error: Parameter with `*` or `**` cannot have default value
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | def foo(a, *args=(1, 2)): ...
|
||||
| ^ Syntax Error: Expected ')', found '('
|
||||
| ^ Syntax Error: Expected `)`, found `(`
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
1 | def foo(a, *args=(1, 2)): ...
|
||||
| ^ Syntax Error: Expected newline, found ')'
|
||||
| ^ Syntax Error: Expected newline, found `)`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ Module(
|
|||
3 | def foo(a, /, b, /): ...
|
||||
4 | def foo(a, *args, /, b): ...
|
||||
5 | def foo(a, //): ...
|
||||
| ^^ Syntax Error: Expected ',', found '//'
|
||||
| ^^ Syntax Error: Expected `,`, found `//`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ Module(
|
|||
|
|
||||
1 | # No indentation before the function definition
|
||||
2 | if call(foo
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
3 | def bar():
|
||||
4 | pass
|
||||
|
|
||||
|
|
@ -803,7 +803,7 @@ Module(
|
|||
|
|
||||
7 | # Indented function definition
|
||||
8 | if call(foo
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
9 | def bar():
|
||||
10 | pass
|
||||
|
|
||||
|
|
@ -812,7 +812,7 @@ Module(
|
|||
|
|
||||
13 | # There are multiple non-logical newlines (blank lines) in the `if` body
|
||||
14 | if call(foo
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
15 |
|
||||
16 |
|
||||
17 | def bar():
|
||||
|
|
@ -822,7 +822,7 @@ Module(
|
|||
|
|
||||
21 | # There are trailing whitespaces in the blank line inside the `if` body
|
||||
22 | if call(foo
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
23 |
|
||||
24 | def bar():
|
||||
25 | pass
|
||||
|
|
@ -832,7 +832,7 @@ Module(
|
|||
|
|
||||
28 | # The lexer is nested with multiple levels of parentheses
|
||||
29 | if call(foo, [a, b
|
||||
| ^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
| ^ Syntax Error: Expected `]`, found NonLogicalNewline
|
||||
30 | def bar():
|
||||
31 | pass
|
||||
|
|
||||
|
|
@ -841,7 +841,7 @@ Module(
|
|||
|
|
||||
34 | # The outer parenthesis is closed but the inner bracket isn't
|
||||
35 | if call(foo, [a, b)
|
||||
| ^ Syntax Error: Expected ']', found ')'
|
||||
| ^ Syntax Error: Expected `]`, found `)`
|
||||
36 | def bar():
|
||||
37 | pass
|
||||
|
|
||||
|
|
@ -850,7 +850,7 @@ Module(
|
|||
|
|
||||
34 | # The outer parenthesis is closed but the inner bracket isn't
|
||||
35 | if call(foo, [a, b)
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
36 | def bar():
|
||||
37 | pass
|
||||
|
|
||||
|
|
@ -860,7 +860,7 @@ Module(
|
|||
41 | # test is to make sure it emits a `NonLogicalNewline` token after `b`.
|
||||
42 | if call(foo, [a,
|
||||
43 | b
|
||||
| ^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
| ^ Syntax Error: Expected `]`, found NonLogicalNewline
|
||||
44 | )
|
||||
45 | def bar():
|
||||
46 | pass
|
||||
|
|
@ -871,7 +871,7 @@ Module(
|
|||
42 | if call(foo, [a,
|
||||
43 | b
|
||||
44 | )
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
45 | def bar():
|
||||
46 | pass
|
||||
|
|
||||
|
|
@ -890,7 +890,7 @@ Module(
|
|||
49 | # F-strings uses normal list parsing, so test those as well
|
||||
50 | if call(f"hello {x
|
||||
51 | def bar():
|
||||
| ^^^ Syntax Error: f-string: expecting '}'
|
||||
| ^^^ Syntax Error: f-string: expecting `}`
|
||||
52 | pass
|
||||
|
|
||||
|
||||
|
|
@ -923,7 +923,7 @@ Module(
|
|||
|
|
||||
55 | if call(f"hello
|
||||
56 | def bar():
|
||||
| ^^^^ Syntax Error: Expected ',', found indent
|
||||
| ^^^^ Syntax Error: Expected `,`, found indent
|
||||
57 | pass
|
||||
|
|
||||
|
||||
|
|
@ -931,7 +931,7 @@ Module(
|
|||
|
|
||||
55 | if call(f"hello
|
||||
56 | def bar():
|
||||
| ^^^ Syntax Error: Expected ')', found 'def'
|
||||
| ^^^ Syntax Error: Expected `)`, found `def`
|
||||
57 | pass
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -113,5 +113,5 @@ Module(
|
|||
|
||||
|
|
||||
1 | if call(foo, [a, b
def bar():
pass
|
||||
| ^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
| ^ Syntax Error: Expected `]`, found NonLogicalNewline
|
||||
|
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | if call(foo, [a, b
|
||||
| ^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
| ^ Syntax Error: Expected `]`, found NonLogicalNewline
|
||||
2 | def bar():
|
||||
3 | pass
|
||||
|
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ Module(
|
|||
|
|
||||
5 | f'middle {'string':\
|
||||
6 | 'format spec'}
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
7 |
|
||||
8 | f'middle {'string':\\
|
||||
|
|
||||
|
|
@ -445,7 +445,7 @@ Module(
|
|||
6 | 'format spec'}
|
||||
7 |
|
||||
8 | f'middle {'string':\\
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
9 | 'format spec'}
|
||||
10 |
|
||||
11 | f'middle {'string':\\\
|
||||
|
|
@ -492,7 +492,7 @@ Module(
|
|||
|
|
||||
11 | f'middle {'string':\\\
|
||||
12 | 'format spec'}
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ Module(
|
|||
|
|
||||
1 | call(a, b, \\\
|
||||
2 |
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
3 | def bar():
|
||||
4 | pass
|
||||
|
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | call(a, b, # comment \
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
2 |
|
||||
3 | def bar():
|
||||
4 | pass
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ Module(
|
|||
|
|
||||
5 | f"""hello {x # comment
|
||||
6 | y = 1
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,5 +80,5 @@ Module(
|
|||
|
|
||||
5 | f'''{foo:.3f
|
||||
6 | '''
|
||||
| ^^^ Syntax Error: f-string: expecting '}'
|
||||
| ^^^ Syntax Error: f-string: expecting `}`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ Module(
|
|||
|
|
||||
5 | if call(f'''{x:.3f
|
||||
6 | '''
|
||||
| ^^^ Syntax Error: f-string: expecting '}'
|
||||
| ^^^ Syntax Error: f-string: expecting `}`
|
||||
7 | pass
|
||||
|
|
||||
|
||||
|
|
@ -118,6 +118,6 @@ Module(
|
|||
|
|
||||
5 | if call(f'''{x:.3f
|
||||
6 | '''
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
| ^ Syntax Error: Expected `)`, found newline
|
||||
7 | pass
|
||||
|
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ Module(
|
|||
9 | # on following lines.
|
||||
10 |
|
||||
11 | def keyword[A, await](): ...
|
||||
| ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'await' that cannot be used here
|
||||
| ^^^^^ Syntax Error: Expected an identifier, but found a keyword `await` that cannot be used here
|
||||
12 |
|
||||
13 | def not_a_type_param[A, |, B](): ...
|
||||
|
|
||||
|
|
@ -385,7 +385,7 @@ Module(
|
|||
11 | def keyword[A, await](): ...
|
||||
12 |
|
||||
13 | def not_a_type_param[A, |, B](): ...
|
||||
| ^ Syntax Error: Expected ',', found '|'
|
||||
| ^ Syntax Error: Expected `,`, found `|`
|
||||
14 |
|
||||
15 | def multiple_commas[A,,B](): ...
|
||||
|
|
||||
|
|
@ -433,7 +433,7 @@ Module(
|
|||
17 | def multiple_trailing_commas[A,,](): ...
|
||||
18 |
|
||||
19 | def multiple_commas_and_recovery[A,,100](): ...
|
||||
| ^^^ Syntax Error: Expected ']', found int
|
||||
| ^^^ Syntax Error: Expected `]`, found int
|
||||
|
|
||||
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ Module(
|
|||
17 | def multiple_trailing_commas[A,,](): ...
|
||||
18 |
|
||||
19 | def multiple_commas_and_recovery[A,,100](): ...
|
||||
| ^ Syntax Error: Expected newline, found ']'
|
||||
| ^ Syntax Error: Expected newline, found `]`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ Module(
|
|||
|
|
||||
1 | # FIXME(micha): This creates two syntax errors instead of just one (and overlapping ones)
|
||||
2 | if True)):
|
||||
| ^ Syntax Error: Expected ':', found ')'
|
||||
| ^ Syntax Error: Expected `:`, found `)`
|
||||
3 | pass
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ Module(
|
|||
2 | # This `as` pattern is unparenthesied so the parser never takes the path
|
||||
3 | # where it might be confused as a complex literal pattern.
|
||||
4 | case x as y + 1j:
|
||||
| ^ Syntax Error: Expected ':', found '+'
|
||||
| ^ Syntax Error: Expected `:`, found `+`
|
||||
5 | pass
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ Module(
|
|||
2 | # Not in the mapping start token set, so the list parsing bails
|
||||
3 | # v
|
||||
4 | case {(x as y): 1}:
|
||||
| ^ Syntax Error: Expected '}', found '('
|
||||
| ^ Syntax Error: Expected `}`, found `(`
|
||||
5 | pass
|
||||
|
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ Module(
|
|||
2 | # Not in the mapping start token set, so the list parsing bails
|
||||
3 | # v
|
||||
4 | case {(x as y): 1}:
|
||||
| ^ Syntax Error: Expected newline, found '}'
|
||||
| ^ Syntax Error: Expected newline, found `}`
|
||||
5 | pass
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ Module(
|
|||
2 | # This `as` pattern is unparenthesized so the parser never takes the path
|
||||
3 | # where it might be confused as a mapping key pattern.
|
||||
4 | case {x as y: 1}:
|
||||
| ^^ Syntax Error: Expected ':', found 'as'
|
||||
| ^^ Syntax Error: Expected `:`, found `as`
|
||||
5 | pass
|
||||
|
|
||||
|
||||
|
|
@ -123,6 +123,6 @@ Module(
|
|||
2 | # This `as` pattern is unparenthesized so the parser never takes the path
|
||||
3 | # where it might be confused as a mapping key pattern.
|
||||
4 | case {x as y: 1}:
|
||||
| ^ Syntax Error: Expected ',', found name
|
||||
| ^ Syntax Error: Expected `,`, found name
|
||||
5 | pass
|
||||
|
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ Module(
|
|||
1 | # Starred expression is not allowed as a mapping pattern key
|
||||
2 | match subject:
|
||||
3 | case {*key}:
|
||||
| ^ Syntax Error: Expected ':', found '}'
|
||||
| ^ Syntax Error: Expected `:`, found `}`
|
||||
4 | pass
|
||||
5 | case {*key: 1}:
|
||||
|
|
||||
|
|
@ -570,7 +570,7 @@ Module(
|
|||
5 | case {*key: 1}:
|
||||
6 | pass
|
||||
7 | case {*key 1}:
|
||||
| ^ Syntax Error: Expected ':', found int
|
||||
| ^ Syntax Error: Expected `:`, found int
|
||||
8 | pass
|
||||
9 | case {*key, None: 1}:
|
||||
|
|
||||
|
|
@ -589,7 +589,7 @@ Module(
|
|||
7 | case {*key 1}:
|
||||
8 | pass
|
||||
9 | case {*key, None: 1}:
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
10 | pass
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ Module(
|
|||
15 | case Foo(x=*_):
|
||||
16 | pass
|
||||
17 | case {*_}:
|
||||
| ^ Syntax Error: Expected ':', found '}'
|
||||
| ^ Syntax Error: Expected `:`, found `}`
|
||||
18 | pass
|
||||
19 | case {*_: 1}:
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1580,7 +1580,7 @@ Module(
|
|||
|
|
||||
4 | with (item1, item2),: ...
|
||||
5 | with (item1, item2), as f: ...
|
||||
| ^^ Syntax Error: Expected ',', found 'as'
|
||||
| ^^ Syntax Error: Expected `,`, found `as`
|
||||
6 | with (item1, item2), item3,: ...
|
||||
7 | with (*item): ...
|
||||
|
|
||||
|
|
@ -1640,7 +1640,7 @@ Module(
|
|||
9 | with (item := 10 as f): ...
|
||||
10 | with (item1, item2 := 10 as f): ...
|
||||
11 | with (x for x in range(10), item): ...
|
||||
| ^ Syntax Error: Expected ')', found ','
|
||||
| ^ Syntax Error: Expected `)`, found `,`
|
||||
12 | with (item, x for x in range(10)): ...
|
||||
|
|
||||
|
||||
|
|
@ -1649,7 +1649,7 @@ Module(
|
|||
9 | with (item := 10 as f): ...
|
||||
10 | with (item1, item2 := 10 as f): ...
|
||||
11 | with (x for x in range(10), item): ...
|
||||
| ^ Syntax Error: Expected ',', found ')'
|
||||
| ^ Syntax Error: Expected `,`, found `)`
|
||||
12 | with (item, x for x in range(10)): ...
|
||||
|
|
||||
|
||||
|
|
@ -1658,7 +1658,7 @@ Module(
|
|||
10 | with (item1, item2 := 10 as f): ...
|
||||
11 | with (x for x in range(10), item): ...
|
||||
12 | with (item, x for x in range(10)): ...
|
||||
| ^^^ Syntax Error: Expected ')', found 'for'
|
||||
| ^^^ Syntax Error: Expected `)`, found `for`
|
||||
13 |
|
||||
14 | # Make sure the parser doesn't report the same error twice
|
||||
|
|
||||
|
|
@ -1668,7 +1668,7 @@ Module(
|
|||
10 | with (item1, item2 := 10 as f): ...
|
||||
11 | with (x for x in range(10), item): ...
|
||||
12 | with (item, x for x in range(10)): ...
|
||||
| ^ Syntax Error: Expected ':', found ')'
|
||||
| ^ Syntax Error: Expected `:`, found `)`
|
||||
13 |
|
||||
14 | # Make sure the parser doesn't report the same error twice
|
||||
|
|
||||
|
|
@ -1707,7 +1707,7 @@ Module(
|
|||
15 | with ((*item)): ...
|
||||
16 |
|
||||
17 | with (*x for x in iter, item): ...
|
||||
| ^ Syntax Error: Expected ')', found ','
|
||||
| ^ Syntax Error: Expected `)`, found `,`
|
||||
18 | with (item1, *x for x in iter, item2): ...
|
||||
19 | with (x as f, *y): ...
|
||||
|
|
||||
|
|
@ -1717,7 +1717,7 @@ Module(
|
|||
15 | with ((*item)): ...
|
||||
16 |
|
||||
17 | with (*x for x in iter, item): ...
|
||||
| ^ Syntax Error: Expected ',', found ')'
|
||||
| ^ Syntax Error: Expected `,`, found `)`
|
||||
18 | with (item1, *x for x in iter, item2): ...
|
||||
19 | with (x as f, *y): ...
|
||||
|
|
||||
|
|
@ -1726,7 +1726,7 @@ Module(
|
|||
|
|
||||
17 | with (*x for x in iter, item): ...
|
||||
18 | with (item1, *x for x in iter, item2): ...
|
||||
| ^^^ Syntax Error: Expected ')', found 'for'
|
||||
| ^^^ Syntax Error: Expected `)`, found `for`
|
||||
19 | with (x as f, *y): ...
|
||||
20 | with (*x, y as f): ...
|
||||
|
|
||||
|
|
@ -1735,7 +1735,7 @@ Module(
|
|||
|
|
||||
17 | with (*x for x in iter, item): ...
|
||||
18 | with (item1, *x for x in iter, item2): ...
|
||||
| ^ Syntax Error: Expected ':', found ')'
|
||||
| ^ Syntax Error: Expected `:`, found `)`
|
||||
19 | with (x as f, *y): ...
|
||||
20 | with (*x, y as f): ...
|
||||
|
|
||||
|
|
@ -1804,7 +1804,7 @@ Module(
|
|||
22 | with (x, yield y, z): ...
|
||||
23 | with (x, yield from y): ...
|
||||
24 | with (x as f, y) as f: ...
|
||||
| ^^ Syntax Error: Expected ':', found 'as'
|
||||
| ^^ Syntax Error: Expected `:`, found `as`
|
||||
25 | with (x for x in iter as y): ...
|
||||
|
|
||||
|
||||
|
|
@ -1813,7 +1813,7 @@ Module(
|
|||
23 | with (x, yield from y): ...
|
||||
24 | with (x as f, y) as f: ...
|
||||
25 | with (x for x in iter as y): ...
|
||||
| ^^ Syntax Error: Expected ')', found 'as'
|
||||
| ^^ Syntax Error: Expected `)`, found `as`
|
||||
26 |
|
||||
27 | # The inner `(...)` is parsed as parenthesized expression
|
||||
|
|
||||
|
|
@ -1823,7 +1823,7 @@ Module(
|
|||
23 | with (x, yield from y): ...
|
||||
24 | with (x as f, y) as f: ...
|
||||
25 | with (x for x in iter as y): ...
|
||||
| ^ Syntax Error: Expected ',', found ')'
|
||||
| ^ Syntax Error: Expected `,`, found `)`
|
||||
26 |
|
||||
27 | # The inner `(...)` is parsed as parenthesized expression
|
||||
|
|
||||
|
|
@ -1832,7 +1832,7 @@ Module(
|
|||
|
|
||||
27 | # The inner `(...)` is parsed as parenthesized expression
|
||||
28 | with ((item as f)): ...
|
||||
| ^^ Syntax Error: Expected ')', found 'as'
|
||||
| ^^ Syntax Error: Expected `)`, found `as`
|
||||
29 |
|
||||
30 | with (item as f), x: ...
|
||||
|
|
||||
|
|
@ -1841,7 +1841,7 @@ Module(
|
|||
|
|
||||
27 | # The inner `(...)` is parsed as parenthesized expression
|
||||
28 | with ((item as f)): ...
|
||||
| ^ Syntax Error: Expected ':', found ')'
|
||||
| ^ Syntax Error: Expected `:`, found `)`
|
||||
29 |
|
||||
30 | with (item as f), x: ...
|
||||
|
|
||||
|
|
@ -1860,7 +1860,7 @@ Module(
|
|||
28 | with ((item as f)): ...
|
||||
29 |
|
||||
30 | with (item as f), x: ...
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
31 | with (item as f1) as f2: ...
|
||||
32 | with (item1 as f, item2 := 0): ...
|
||||
|
|
||||
|
|
@ -1869,7 +1869,7 @@ Module(
|
|||
|
|
||||
30 | with (item as f), x: ...
|
||||
31 | with (item as f1) as f2: ...
|
||||
| ^^ Syntax Error: Expected ':', found 'as'
|
||||
| ^^ Syntax Error: Expected `:`, found `as`
|
||||
32 | with (item1 as f, item2 := 0): ...
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -401,5 +401,5 @@ Module(
|
|||
7 | with *item1, item2 as f: pass
|
||||
8 | with item1 as f, *item2: pass
|
||||
9 | with item := 0 as f: pass
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ Module(
|
|||
|
|
||||
1 | # parse_options: {"target-version": "3.14"}
|
||||
2 | t"{lambda x: x}"
|
||||
| ^^ Syntax Error: t-string: expecting '}'
|
||||
| ^^ Syntax Error: t-string: expecting `}`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ Module(
|
|||
1 | # parse_options: {"target-version": "3.14"}
|
||||
2 | t"{"
|
||||
3 | t"{foo!r"
|
||||
| ^ Syntax Error: t-string: expecting '}'
|
||||
| ^ Syntax Error: t-string: expecting `}`
|
||||
4 | t"{foo="
|
||||
5 | t"{"
|
||||
|
|
||||
|
|
@ -269,7 +269,7 @@ Module(
|
|||
2 | t"{"
|
||||
3 | t"{foo!r"
|
||||
4 | t"{foo="
|
||||
| ^ Syntax Error: t-string: expecting '}'
|
||||
| ^ Syntax Error: t-string: expecting `}`
|
||||
5 | t"{"
|
||||
6 | t"""{"""
|
||||
|
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ Module(
|
|||
|
|
||||
1 | # parse_options: {"target-version": "3.14"}
|
||||
2 | t"hello {x:"
|
||||
| ^ Syntax Error: t-string: expecting '}'
|
||||
| ^ Syntax Error: t-string: expecting `}`
|
||||
3 | t"hello {x:.3f"
|
||||
|
|
||||
|
||||
|
|
@ -152,5 +152,5 @@ Module(
|
|||
1 | # parse_options: {"target-version": "3.14"}
|
||||
2 | t"hello {x:"
|
||||
3 | t"hello {x:.3f"
|
||||
| ^ Syntax Error: t-string: expecting '}'
|
||||
| ^ Syntax Error: t-string: expecting `}`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ Module(
|
|||
2 | type X[T: yield x] = int
|
||||
3 | type X[T: yield from x] = int
|
||||
4 | type X[T: x := int] = int
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | type X[**T: int] = int
|
||||
| ^ Syntax Error: Expected ']', found ':'
|
||||
| ^ Syntax Error: Expected `]`, found `:`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ Module(
|
|||
2 | type X[**P = yield x] = int
|
||||
3 | type X[**P = yield from x] = int
|
||||
4 | type X[**P = x := int] = int
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
5 | type X[**P = *int] = int
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ Module(
|
|||
3 | type X[T = (yield x)] = int
|
||||
4 | type X[T = yield from x] = int
|
||||
5 | type X[T = x := int] = int
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
6 | type X[T: int = *int] = int
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ Module(
|
|||
|
||||
|
|
||||
1 | type X[*T: int] = int
|
||||
| ^ Syntax Error: Expected ']', found ':'
|
||||
| ^ Syntax Error: Expected `]`, found `:`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ Module(
|
|||
3 | type X[*Ts = yield x] = int
|
||||
4 | type X[*Ts = yield from x] = int
|
||||
5 | type X[*Ts = x := int] = int
|
||||
| ^^ Syntax Error: Expected ',', found ':='
|
||||
| ^^ Syntax Error: Expected `,`, found `:=`
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ Module(
|
|||
2 | 1 + 1
|
||||
3 | f"hello {x
|
||||
4 | 2 + 2
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
| ^ Syntax Error: f-string: expecting `}`
|
||||
5 | f"hello {x:
|
||||
6 | 3 + 3
|
||||
|
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ Module(
|
|||
1 | while *x: ...
|
||||
2 | while yield x: ...
|
||||
3 | while a, b: ...
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
4 | while a := 1, b: ...
|
||||
|
|
||||
|
||||
|
|
@ -210,5 +210,5 @@ Module(
|
|||
2 | while yield x: ...
|
||||
3 | while a, b: ...
|
||||
4 | while a := 1, b: ...
|
||||
| ^ Syntax Error: Expected ':', found ','
|
||||
| ^ Syntax Error: Expected `:`, found `,`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ Module(
|
|||
1 | while (
|
||||
2 | a < 30 # comment
|
||||
3 | )
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
4 | pass
|
||||
|
|
||||
|
|
|
|||
|
|
@ -62,6 +62,6 @@ Module(
|
|||
|
|
||||
1 | # `)` followed by a newline
|
||||
2 | with (item1, item2)
|
||||
| ^ Syntax Error: Expected ':', found newline
|
||||
| ^ Syntax Error: Expected `:`, found newline
|
||||
3 | pass
|
||||
|
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue