-
Notifications
You must be signed in to change notification settings - Fork 656
fix: keep quotes in the case of keys that are octal literals #4309
Conversation
✅ Deploy Preview for docs-rometools canceled.Built without sensitive environment variables
|
@@ -247,6 +247,11 @@ impl<'token> LiteralStringNormaliser<'token> { | |||
let mut has_seen_number = false; | |||
text_to_check.chars().enumerate().all(|(index, c)| { | |||
if index == 0 && c.is_numeric() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we have to use here is_ascii_digit What do you think?
Because is_numeric
https://doc.rust-lang.org/std/primitive.char.html#method.is_numeric
assert!('৬'.is_numeric());
assert!('¾'.is_numeric());
assert!('①'.is_numeric());
I'm not sure if it's valid.
Could you test please? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denbezrukov do you have an use case/test case that we can use ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use is_ascii_digit
and update test 👍
|
||
const x = { | ||
¾¾¾¾: "test1", | ||
①: "test2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that correct one is
const x = {
"¾¾¾¾": "test1",
"①": "test2",
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to fix in 10b568f.
Summary
Fix #4284
Test Plan
I updated tests and confirmed the issue was fixed.
Documentation