Skip to content

Commit c01f014

Browse files
authored
Merge pull request RustPython#4340 from harupy/fix-locations-of-parethesized-expressions
Fix the start and end locations of `Tuple`
2 parents b4b74a8 + 1bebc78 commit c01f014

14 files changed

+41
-45
lines changed

Lib/test/test_ast.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,8 +2107,6 @@ def test_boolop(self):
21072107
self._check_content(s, bop.values[1],
21082108
'other_condition or yet_another_one')
21092109

2110-
# TODO: RUSTPYTHON
2111-
@unittest.expectedFailure
21122110
def test_tuples(self):
21132111
s1 = 'x = () ;'
21142112
s2 = 'x = 1 , ;'
@@ -2190,8 +2188,6 @@ async def f():
21902188
self._check_content(s, fdef.body[0].value, 'yield x')
21912189
self._check_content(s, fdef.body[1].value, 'await y')
21922190

2193-
# TODO: RUSTPYTHON
2194-
@unittest.expectedFailure
21952191
def test_source_segment_multi(self):
21962192
s_orig = dedent('''
21972193
x = (

compiler/parser/python.lalrpop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ AtomAs<Goal>: Goal = {
10891089
node: ast::ExprKind::ListComp { elt: Box::new(elt), generators }
10901090
}.into()
10911091
},
1092-
"(" <location:@L> <items:OneOrMore<TestOrStarNamedExprOrWithitem>> <trailing_comma:","?> <end_location:@R> ")" =>? {
1092+
<location:@L> "(" <items:OneOrMore<TestOrStarNamedExprOrWithitem>> <trailing_comma:","?> ")" <end_location:@R> =>? {
10931093
if items.len() == 1 && items[0].1.is_none() && trailing_comma.is_none() {
10941094
match items[0].0.node {
10951095
ast::ExprKind::Starred { .. } => {

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)