mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-25 05:53:51 +00:00
[syntax-errors] Raise unsupported syntax error for template strings prior to Python 3.14 (#18664)
Closes #18662 One question is whether we would like the range to exclude the quotes?
This commit is contained in:
parent
793ff9bdbc
commit
1889a5e6eb
5 changed files with 459 additions and 2 deletions
|
@ -1250,10 +1250,30 @@ impl<'src> Parser<'src> {
|
|||
.into(),
|
||||
));
|
||||
} else if self.at(TokenKind::TStringStart) {
|
||||
strings.push(StringType::TString(
|
||||
// test_ok template_strings_py314
|
||||
// # parse_options: {"target-version": "3.14"}
|
||||
// t"{hey}"
|
||||
// t'{there}'
|
||||
// t"""what's
|
||||
// happening?"""
|
||||
// "implicitly"t"concatenated"
|
||||
|
||||
// test_err template_strings_py313
|
||||
// # parse_options: {"target-version": "3.13"}
|
||||
// t"{hey}"
|
||||
// t'{there}'
|
||||
// t"""what's
|
||||
// happening?"""
|
||||
// "implicitly"t"concatenated"
|
||||
let string_type = StringType::TString(
|
||||
self.parse_interpolated_string(InterpolatedStringKind::TString)
|
||||
.into(),
|
||||
));
|
||||
);
|
||||
self.add_unsupported_syntax_error(
|
||||
UnsupportedSyntaxErrorKind::TemplateStrings,
|
||||
string_type.range(),
|
||||
);
|
||||
strings.push(string_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue