Fix normalization of strings with overflowing unicode

This commit is contained in:
Joshua Warner 2024-12-15 10:29:01 -08:00
parent 0d182fbd28
commit 4e3df6bde2
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
6 changed files with 44 additions and 4 deletions

View file

@ -360,8 +360,8 @@ impl<'a> Input<'a> {
* * * AST after formatting:\n{:#?}\n\n",
self.as_str(),
output.as_ref().as_str(),
actual,
reparsed_ast
ast_normalized,
reparsed_ast_normalized
);
}

View file

@ -0,0 +1,27 @@
@0-14 SpaceAfter(
Apply(
@0-1 Var {
module_name: "",
ident: "m",
},
[
@1-13 Str(
Line(
[
Unicode(
@5-11 "FFFFFF",
),
],
),
),
@13-14 Var {
module_name: "",
ident: "s",
},
],
Space,
),
[
Newline,
],
)

View file

@ -0,0 +1 @@
m"\u(FFFFFF)"s

View file

@ -708,6 +708,7 @@ mod test_snapshots {
pass/underscore_backpassing.expr,
pass/underscore_expr_in_def.expr,
pass/underscore_in_assignment_pattern.expr,
pass/unicode_overflow_str.expr,
pass/value_def_confusion.expr,
pass/var_else.expr,
pass/var_if.expr,