Commit 7e2cf8d
authored
feat(react-compiler): tighten core validation parity for upstream fixtures (#11734)
## Summary
This PR continues the React Compiler SWC core-only parity work in
`crates/swc_ecma_react_compiler`.
### What changed
- Aligned `compile_fn` pipeline ordering with upstream behavior in
[`program.rs`](crates/swc_ecma_react_compiler/src/entrypoint/program.rs):
- Run `validate_locals_not_reassigned_after_render` unconditionally
after `infer_mutation_aliasing_ranges`.
- Replaced no-op validator with implementation:
- `validate_no_capitalized_calls`
- Added a conservative but working implementation for:
- `validate_context_variable_lvalues`
- Reduced false positives and improved message parity in:
- `validate_locals_not_reassigned_after_render`
- (focuses on async reassignment path in this round)
- Improved hooks validation behavior:
- dynamic-hook call diagnostics
- optional-call handling
- assignment-based hook alias tracking
## Fixture metrics
Using:
```bash
REACT_COMPILER_FIXTURE_CONTINUE_ON_FAIL=1 REACT_COMPILER_FIXTURE_ALLOW_FAILURE=1 cargo test -p swc_ecma_react_compiler fixture_cases_upstream -- --nocapture
```
- Prior baseline (from previous parity round):
- `mismatch=844`
- `missing_diag=192`
- `missing_fragment=34`
- Current (this branch):
- `mismatch=842`
- `missing_diag=167`
- `missing_fragment=31`
- total failed fixtures: `1040`
Top mismatch clusters currently remain:
- `propagate-scope-deps-hir-fork/* = 47`
- `preserve-memo-validation/* = 40`
- `ssa-* (top-level) = 35`
## Verification
- `git submodule update --init --recursive`
- `cargo check -p swc_ecma_react_compiler`
- `cargo test -p swc_ecma_react_compiler fixture_cases_local --
--nocapture`
- `cargo test -p swc_ecma_react_compiler fixture_cases_upstream_phase1
-- --nocapture`
- `cargo fmt --all`
- `cargo clippy --all --all-targets -- -D warnings`
Notes:
- `cargo test -p swc_ecma_react_compiler` still fails on expected
upstream mismatch fixtures (non-continue mode).1 parent abaee54 commit 7e2cf8d
File tree
5 files changed
+657
-45
lines changed- crates/swc_ecma_react_compiler/src
- entrypoint
- validation
5 files changed
+657
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
0 commit comments