Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to Unicode 15.1 #3424

Merged
merged 2 commits into from
Oct 11, 2023
Merged

update to Unicode 15.1 #3424

merged 2 commits into from
Oct 11, 2023

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Oct 5, 2023

No description provided.

@JLHwung
Copy link
Contributor Author

JLHwung commented Oct 7, 2023

The Unicode 15.1 has marked U+30FB and U+FF65 as Other_ID_Continue

https://www.unicode.org/Public/15.1.0/ucd/PropList.txt

so they are now valid ES6+ identifiers again, though the browsers are not catching up yet.

@evanw Do you want to en-quote them in literal keys for browser compat? Or do you think we can move forward and just remove this test

func TestUnicodeIdentifierNames(t *testing.T) {
// There are two code points that are valid in identifiers in ES5 but not in ES6+:
//
// U+30FB KATAKANA MIDDLE DOT
// U+FF65 HALFWIDTH KATAKANA MIDDLE DOT
//
expectPrinted(t, "x = {x・: 0}", "x = { \"x・\": 0 };\n")
expectPrinted(t, "x = {x・: 0}", "x = { \"x・\": 0 };\n")
expectPrinted(t, "x = {xπ: 0}", "x = { xπ: 0 };\n")
expectPrinted(t, "x = y.x・", "x = y[\"x・\"];\n")
expectPrinted(t, "x = y.x・", "x = y[\"x・\"];\n")
expectPrinted(t, "x = y.xπ", "x = y.xπ;\n")
}

Babel updated to Unicode 15.1 three weeks ago and no one ever complain that the katagana middle dot is not quoted anymore.

@evanw
Copy link
Owner

evanw commented Oct 11, 2023

I think they still have to be quoted. According to this, Unicode 4.1 through Unicode 15 omitted these characters from ID_Continue by accident. Unicode 15.1 adds them back but they are still syntax errors in older browsers. For example, Firefox 118 throws Uncaught SyntaxError: illegal character U+30FB when trying to run the unquoted code.

@JLHwung
Copy link
Contributor Author

JLHwung commented Oct 11, 2023

Thanks for the background update, it is very helpful.

On the other hand, U+30FB will be valid ID_Continue again, I think we should start accepting these two in IdentifierName, but quote them in literal object key for browser compatibility. Otherwise once browsers update to Unicode 15.1, it will seems like a bug when browser accepts U+30FB in ID_Continue but esbuild throws on them.

Ah we are already taking this approach, now it looks good to me.

@evanw evanw merged commit b94c7a0 into evanw:main Oct 11, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants