[rust-compiler] Fix non-exhaustive PatternLike match in scope_resolution test#36499
Merged
poteto merged 1 commit intoMay 20, 2026
Merged
Conversation
…ion test `cargo test -p react_compiler_ast` (and `cargo test --workspace`) fails to compile because the `visit_pat` helper in the scope_resolution integration test does not handle the four TS cast-wrapper variants of `PatternLike` (TSAsExpression, TSSatisfiesExpression, TSNonNullExpression, TSTypeAssertion) that were added to `PatternLike` in facebook#36492 to support TS cast wrappers as assignment targets. Add the four missing arms, mirroring how `visit_expr` in the same file already handles these same wrapper types (descend into the inner expression with `visit_expr`; visit the type annotation JSON where present). Before this change: cargo test --workspace error[E0004]: non-exhaustive patterns: `&mut PatternLike::TSAsExpression(_)`, `&mut PatternLike::TSSatisfiesExpression(_)`, `&mut PatternLike::TSNonNullExpression(_)` and 1 more not covered After: cargo test --workspace TOTAL: 56 passed, 0 failed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
cargo test --workspace(andcargo test -p react_compiler_ast) currently fails to compile onpr-36173:The
visit_pathelper in thescope_resolutionintegration test was not updated when #36492 added four TS cast-wrapper variants toPatternLike(TSAsExpression,TSSatisfiesExpression,TSNonNullExpression,TSTypeAssertion) to support TS cast wrappers as assignment targets.This PR adds those four arms to the test helper, mirroring exactly how
visit_exprin the same file already handles these same wrapper types: descend into the innerExpressionwithvisit_expr, and visit the type annotation JSON (where present) withvisit_json.Why
The Rust unit-test suite is currently zero-signal —
cargo test --workspacecannot even compile, let alone run. This change restores it.Test plan
cargo test --workspacecompiles cleanlycargo test --workspace→ 56 passed, 0 failed, 0 ignored