Skip to content

test(transformer/styled-components): add failing test case for comment removal#12202

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal
Jul 11, 2025
Merged

test(transformer/styled-components): add failing test case for comment removal#12202
graphite-app[bot] merged 1 commit intomainfrom
07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 10, 2025

Failing test case which demonstrates a bug with comments removal from CSS. The last 2 expressions are in wrong order.

Problem is likely swap_remove, which alters order of the Vec's elements:

// Remove expressions that are not kept after minification.
for i in (0..expressions.len()).rev() {
if !remained_expression_indices.contains(&i) {
expressions.swap_remove(i);
}
}

Copy link
Member Author

overlookmotel commented Jul 10, 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.

@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label Jul 10, 2025
@github-actions github-actions bot added the C-test Category - Testing. Code is missing test cases, or a PR is adding them label Jul 10, 2025
@overlookmotel overlookmotel marked this pull request as ready for review July 10, 2025 17:32
@overlookmotel overlookmotel requested a review from Dunqing July 10, 2025 17:32
@graphite-app graphite-app bot changed the base branch from 07-10-test_transformer_styled-components_reformat_test_case_output to graphite-base/12202 July 10, 2025 17:35
@graphite-app graphite-app bot force-pushed the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch from 7feef3d to 8745c89 Compare July 10, 2025 17:44
@graphite-app graphite-app bot force-pushed the graphite-base/12202 branch from 7baf7ca to 7b1f4a5 Compare July 10, 2025 17:44
@graphite-app graphite-app bot changed the base branch from graphite-base/12202 to main July 10, 2025 17:45
@graphite-app graphite-app bot force-pushed the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch from 8745c89 to 6749f11 Compare July 10, 2025 17:45
@Dunqing Dunqing force-pushed the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch from 6749f11 to 75fb8cc Compare July 11, 2025 05:18
@Dunqing Dunqing changed the base branch from main to graphite-base/12202 July 11, 2025 05:20
@Dunqing Dunqing force-pushed the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch from 75fb8cc to a2be0e0 Compare July 11, 2025 05:20
@Dunqing Dunqing changed the base branch from graphite-base/12202 to 07-11-perf_transformer_styled-components_cache_block_name July 11, 2025 05:20
Copy link
Member Author

overlookmotel commented Jul 11, 2025

Merge activity

…t removal (#12202)

Failing test case which demonstrates a bug with comments removal from CSS. The last 2 expressions are in wrong order.

Problem is likely `swap_remove`, which alters order of the `Vec`'s elements:

https://github.com/oxc-project/oxc/blob/86eb10882eeacbe05a0dc5e0e3adfad9a9890821/crates/oxc_transformer/src/plugins/styled_components.rs#L407-L412
@graphite-app graphite-app bot force-pushed the 07-11-perf_transformer_styled-components_cache_block_name branch from ac177b4 to 9a20cde Compare July 11, 2025 09:08
@graphite-app graphite-app bot force-pushed the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch from a2be0e0 to 47ff2bb Compare July 11, 2025 09:09
Base automatically changed from 07-11-perf_transformer_styled-components_cache_block_name to main July 11, 2025 09:16
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 11, 2025
@graphite-app graphite-app bot merged commit 47ff2bb into main Jul 11, 2025
17 checks passed
@graphite-app graphite-app bot deleted the 07-10-test_transformer_styled-components_add_failing_test_case_for_comment_removal branch July 11, 2025 09:18
graphite-app bot pushed a commit that referenced this pull request Jul 11, 2025
…r is wrong after minification (#12211)

Related: #12202

`swap_remove` will swap the last element to the index you want to remove, so this will cause the expression's order to be incorrect. Here is order sensitive, so we can't use `swap_remove`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants