[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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user