fix(minifier): avoid generating invalid spans#15778
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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 Performance ReportMerging #15778 will not alter performanceComparing Summary
Footnotes
|
20b0a23 to
a40d23d
Compare
3a86d9c to
1753fcb
Compare
5bb2097 to
4d2fc3b
Compare
1753fcb to
934dbbb
Compare
Merge activity
|
This debug assertion failed https://github.com/oxc-project/oxc/blob/ef4cc33b5cedde82d5b5f91355d7b39436bdbcd6/crates/oxc_span/src/span.rs#L169 when it's called by https://github.com/oxc-project/oxc/blob/c023ba67e07283bad3a43ef9bcc0336c94aa42ae/crates/oxc_codegen/src/gen.rs#L2123 which was caused by https://github.com/oxc-project/oxc/blob/102365da3dd02f5cdd444eaf04f8bbf91c814886/crates/oxc_minifier/src/peephole/fold_constants.rs#L445 This PR fixes these kinds of issues. This PR adds a test but does not fail even without the change. I'll fail once #15787 is done.
Add `Span::merge_within` method that creates a connected Span that is covered by both Spans if they are within a specified Span. The bug described in the OP of #15778 is caused by trying to create a Span assuming that the Spans are adjacent. This method would avoid that kind of issue.
3b5c907 to
6cff132
Compare
934dbbb to
f386efc
Compare
### 💥 BREAKING CHANGES - cbb27fd ast: [**BREAKING**] Add `TSGlobalDeclaration` type (#15712) (overlookmotel) ### 🚀 Features - 0c1f82b linter/plugins: Add `tokens` property to `Program` (#16020) (overlookmotel) - 6cff132 span: Add `Span::merge_within` method (#15869) (sapphi-red) - 102365d allocator/vec: Add `Vec::into_bump_slice` method (#15770) (Dunqing) ### 🐛 Bug Fixes - e2ca770 codegen: Add support for printing type arguments in new expressions (#15963) (Ives van Hoorne) - 2bd3cb6 apps, editors, napi: Fix `oxlint-disable` comments (#16014) (overlookmotel) - 622cb5e parser: Preserve legal comments with @preserve/@license when preceded by other annotations (#15929) (copilot-swe-agent) - 7c46a9e transformer/tagged-template-transform: Handle `\n` escape sequences (#15830) (Dunqing) - f386efc minifier: Avoid generating invalid spans (#15778) (sapphi-red) - d4ff004 parser: Forbid invalid modifiers on `module` and `global` (#15723) (overlookmotel) - 2191ae9 semantic: Allow reserved keywords in typescript ambient contexts (#15495) (sapphi-red) - 7d1ebad isolated-declarations: Incorrect nested namespace output in isolated declarations (#15800) (copilot-swe-agent) ### ⚡ Performance - b4b0ed8 transformer/typescript: Reverse order of checks (#15722) (overlookmotel) ### 📚 Documentation - c81a331 data_structures: Doc comments on fields of `Stack` (#15793) (overlookmotel) - cfae31d allocator: Use `allocator` as var name in examples (#15781) (overlookmotel) Co-authored-by: Boshen <[email protected]>
Add `Span::merge_within` method that creates a connected Span that is covered by both Spans if they are within a specified Span. The bug described in the OP of oxc-project#15778 is caused by trying to create a Span assuming that the Spans are adjacent. This method would avoid that kind of issue.
This debug assertion failed https://github.com/oxc-project/oxc/blob/ef4cc33b5cedde82d5b5f91355d7b39436bdbcd6/crates/oxc_span/src/span.rs#L169 when it's called by https://github.com/oxc-project/oxc/blob/c023ba67e07283bad3a43ef9bcc0336c94aa42ae/crates/oxc_codegen/src/gen.rs#L2123 which was caused by https://github.com/oxc-project/oxc/blob/102365da3dd02f5cdd444eaf04f8bbf91c814886/crates/oxc_minifier/src/peephole/fold_constants.rs#L445 This PR fixes these kinds of issues. This PR adds a test but does not fail even without the change. I'll fail once oxc-project#15787 is done.
### 💥 BREAKING CHANGES - cbb27fd ast: [**BREAKING**] Add `TSGlobalDeclaration` type (oxc-project#15712) (overlookmotel) ### 🚀 Features - 0c1f82b linter/plugins: Add `tokens` property to `Program` (oxc-project#16020) (overlookmotel) - 6cff132 span: Add `Span::merge_within` method (oxc-project#15869) (sapphi-red) - 102365d allocator/vec: Add `Vec::into_bump_slice` method (oxc-project#15770) (Dunqing) ### 🐛 Bug Fixes - e2ca770 codegen: Add support for printing type arguments in new expressions (oxc-project#15963) (Ives van Hoorne) - 2bd3cb6 apps, editors, napi: Fix `oxlint-disable` comments (oxc-project#16014) (overlookmotel) - 622cb5e parser: Preserve legal comments with @preserve/@license when preceded by other annotations (oxc-project#15929) (copilot-swe-agent) - 7c46a9e transformer/tagged-template-transform: Handle `\n` escape sequences (oxc-project#15830) (Dunqing) - f386efc minifier: Avoid generating invalid spans (oxc-project#15778) (sapphi-red) - d4ff004 parser: Forbid invalid modifiers on `module` and `global` (oxc-project#15723) (overlookmotel) - 2191ae9 semantic: Allow reserved keywords in typescript ambient contexts (oxc-project#15495) (sapphi-red) - 7d1ebad isolated-declarations: Incorrect nested namespace output in isolated declarations (oxc-project#15800) (copilot-swe-agent) ### ⚡ Performance - b4b0ed8 transformer/typescript: Reverse order of checks (oxc-project#15722) (overlookmotel) ### 📚 Documentation - c81a331 data_structures: Doc comments on fields of `Stack` (oxc-project#15793) (overlookmotel) - cfae31d allocator: Use `allocator` as var name in examples (oxc-project#15781) (overlookmotel) Co-authored-by: Boshen <[email protected]>

This debug assertion failed
oxc/crates/oxc_span/src/span.rs
Line 169 in ef4cc33
when it's called by
oxc/crates/oxc_codegen/src/gen.rs
Line 2123 in c023ba6
which was caused by
oxc/crates/oxc_minifier/src/peephole/fold_constants.rs
Line 445 in 102365d
This PR fixes these kinds of issues. This PR adds a test but does not fail even without the change. I'll fail once #15787 is done.