Apply NFKC normalization to unicode identifiers in the lexer (#10412)

This commit is contained in:
Alex Waygood 2024-03-18 11:56:56 +00:00 committed by GitHub
parent bb540718c2
commit 92e6026446
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 68 additions and 15 deletions

View file

@ -1,4 +1,4 @@
use ruff_formatter::{write, FormatContext};
use ruff_formatter::write;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprName;
@ -11,16 +11,11 @@ pub struct FormatExprName;
impl FormatNodeRule<ExprName> for FormatExprName {
fn fmt_fields(&self, item: &ExprName, f: &mut PyFormatter) -> FormatResult<()> {
let ExprName { id, range, ctx: _ } = item;
debug_assert_eq!(
id.as_str(),
f.context()
.source_code()
.slice(*range)
.text(f.context().source_code())
);
let ExprName {
id: _,
range,
ctx: _,
} = item;
write!(f, [source_text_slice(*range)])
}