Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Mar 22, 2025

It looks like invalid pair wasn't preserved properly. For example, tasks/coverage/test262/test/built-ins/RegExp/escape/escaped-surrogates.js has such code like this:

https://playground.oxc.rs/#eNplkU1TAjEMhv8K0wsXcAEFEceDCnjUgSuX0g1LtdvsJC0fw/Df7RKWccbT0ybp+ybNSRk1UQY9hxZ6aL202qtVnI57vfbzyks87PFPXNCv0yufZa2g+YczgzsgXUAWgMNgNLgwW0frQtd6zhZQzA5VBmx0BVfkXY5EWOhUe/fNjd3WFtvlLfFBGKv+f3/BQHAveBAMBSPBo2AseBK8Ct4E74KpYCaY1xOqjkI1OSmKvgYffdAHNQkUoaOc9UFNNtpxurDBCpoMH8s1uuYWSHveIJXX4nNHVZoYqJbUzuF+ASGS/4yBbQ7z6E2wmAzleUWQanfwpQk8SzRJ1O4XiXS+OYhm0FRAak0BD3r9YRrCMrr0m/kUjNOka/mk1HRjMIcCLhOC12sHS4xkoNTVza203m5s45cWFQjdPLVeP0qrXyOn6UXwfP4FSqrNaw==

input

const one = '\uD800';
const two = '\uD800\uD801';

// tasks/coverage/test262/test/built-ins/RegExp/escape/escaped-surrogates.js
const highSurrogatesGroup1 = '\uD800\uD801\uD802\uD803\uD804\uD805\uD806\uD807\uD808\uD809\uD80A\uD80B\uD80C\uD80D\uD80E\uD80F';

output

const one = '\uD800';
const two = "\\ud800\\ud801";
const highSurrogatesGroup1 = "\\ud800\\ud801\\ud802\\ud803\\ud804\\ud805\\ud806\\ud807\\ud808\\ud809\\ud80a\\ud80b\\ud80c\\ud80d\\ud80e\\ud80f";

@github-actions github-actions bot added A-parser Area - Parser A-codegen Area - Code Generation C-bug Category - Bug labels Mar 22, 2025
Copy link
Contributor Author

hi-ogawa commented Mar 22, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 22, 2025

CodSpeed Instrumentation Performance Report

Merging #9964 will not alter performance

Comparing 03-22-fix_parser_handle_invalid_surrogate_pair_as_lossy (eaea5fd) with main (c2f1be0)

Summary

✅ 33 untouched benchmarks

@hi-ogawa hi-ogawa marked this pull request as ready for review March 22, 2025 07:16
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Mar 22, 2025
Copy link
Member

Boshen commented Mar 22, 2025

Merge activity

  • Mar 22, 6:11 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 22, 11:46 PM EDT: A user merged this pull request with the Graphite merge queue.

- Closes #3526

It looks like invalid pair wasn't preserved properly. For example, `tasks/coverage/test262/test/built-ins/RegExp/escape/escaped-surrogates.js` has such code like this:

https://playground.oxc.rs/#eNplkU1TAjEMhv8K0wsXcAEFEceDCnjUgSuX0g1LtdvsJC0fw/Df7RKWccbT0ybp+ybNSRk1UQY9hxZ6aL202qtVnI57vfbzyks87PFPXNCv0yufZa2g+YczgzsgXUAWgMNgNLgwW0frQtd6zhZQzA5VBmx0BVfkXY5EWOhUe/fNjd3WFtvlLfFBGKv+f3/BQHAveBAMBSPBo2AseBK8Ct4E74KpYCaY1xOqjkI1OSmKvgYffdAHNQkUoaOc9UFNNtpxurDBCpoMH8s1uuYWSHveIJXX4nNHVZoYqJbUzuF+ASGS/4yBbQ7z6E2wmAzleUWQanfwpQk8SzRJ1O4XiXS+OYhm0FRAak0BD3r9YRrCMrr0m/kUjNOka/mk1HRjMIcCLhOC12sHS4xkoNTVza203m5s45cWFQjdPLVeP0qrXyOn6UXwfP4FSqrNaw==

input

```js
const one = '\uD800';
const two = '\uD800\uD801';

// tasks/coverage/test262/test/built-ins/RegExp/escape/escaped-surrogates.js
const highSurrogatesGroup1 = '\uD800\uD801\uD802\uD803\uD804\uD805\uD806\uD807\uD808\uD809\uD80A\uD80B\uD80C\uD80D\uD80E\uD80F';
```

output

```js
const one = '\uD800';
const two = "\\ud800\\ud801";
const highSurrogatesGroup1 = "\\ud800\\ud801\\ud802\\ud803\\ud804\\ud805\\ud806\\ud807\\ud808\\ud809\\ud80a\\ud80b\\ud80c\\ud80d\\ud80e\\ud80f";
```
@graphite-app graphite-app bot force-pushed the 03-22-fix_parser_handle_invalid_surrogate_pair_as_lossy branch from aaf6bf2 to eaea5fd Compare March 23, 2025 03:40
@graphite-app graphite-app bot merged commit eaea5fd into main Mar 23, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 03-22-fix_parser_handle_invalid_surrogate_pair_as_lossy branch March 23, 2025 03:46
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegen: string surrogates printed incorrectly

3 participants