Skip to content

Commit 93f3433

Browse files
committed
Fix the end location of an implicitly-concatenated string
1 parent 77e5d0c commit 93f3433

6 files changed

+7
-6
lines changed

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_1.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_2.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_3.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_1.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_2.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/string.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn parse_strings(
1212
// Preserve the initial location and kind.
1313
let initial_start = values[0].0;
1414
let initial_end = values[0].2;
15+
let last_end = values.last().unwrap().2;
1516
let initial_kind = (values[0].1 .1 == StringKind::U).then(|| "u".to_owned());
1617

1718
// Optimization: fast-track the common case of a single string.
@@ -84,7 +85,7 @@ pub fn parse_strings(
8485
Ok(if has_fstring {
8586
Expr::new(
8687
initial_start,
87-
initial_end,
88+
last_end,
8889
ExprKind::JoinedStr { values: deduped },
8990
)
9091
} else {

0 commit comments

Comments
 (0)