mirror of
https://github.com/astral-sh/ruff
synced 2026-01-08 15:14:19 -05: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:
@@ -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():
|
||||
def bar():
|
||||
pass
|
||||
|
||||
@@ -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
|
||||
|
|
||||
|
||||
@@ -338,7 +338,7 @@ Module(
|
||||
|
||||
|
|
||||
1 | with (item1 item2): ...
|
||||
| ^^^^^ Syntax Error: Expected ',', found name
|
||||
| ^^^^^ Syntax Error: Expected `,`, found name
|
||||
2 | with (item1 as f1 item2): ...
|
||||
3 | with (item1, item2 item3, item4): ...
|
||||
|
|
||||
@@ -347,7 +347,7 @@ Module(
|
||||
|
|
||||
1 | with (item1 item2): ...
|
||||
2 | with (item1 as f1 item2): ...
|
||||
| ^^^^^ Syntax Error: Expected ',', found name
|
||||
| ^^^^^ Syntax Error: Expected `,`, found name
|
||||
3 | with (item1, item2 item3, item4): ...
|
||||
4 | with (item1, item2 as f1 item3, item4): ...
|
||||
|
|
||||
@@ -357,7 +357,7 @@ Module(
|
||||
1 | with (item1 item2): ...
|
||||
2 | with (item1 as f1 item2): ...
|
||||
3 | with (item1, item2 item3, item4): ...
|
||||
| ^^^^^ Syntax Error: Expected ',', found name
|
||||
| ^^^^^ Syntax Error: Expected `,`, found name
|
||||
4 | with (item1, item2 as f1 item3, item4): ...
|
||||
5 | with (item1, item2: ...
|
||||
|
|
||||
@@ -367,7 +367,7 @@ Module(
|
||||
2 | with (item1 as f1 item2): ...
|
||||
3 | with (item1, item2 item3, item4): ...
|
||||
4 | with (item1, item2 as f1 item3, item4): ...
|
||||
| ^^^^^ Syntax Error: Expected ',', found name
|
||||
| ^^^^^ Syntax Error: Expected `,`, found name
|
||||
5 | with (item1, item2: ...
|
||||
|
|
||||
|
||||
@@ -376,5 +376,5 @@ Module(
|
||||
3 | with (item1, item2 item3, item4): ...
|
||||
4 | with (item1, item2 as f1 item3, item4): ...
|
||||
5 | with (item1, item2: ...
|
||||
| ^ Syntax Error: Expected ')', found ':'
|
||||
| ^ Syntax Error: Expected `)`, found `:`
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user