Skip to content

[rust-compiler] Fix non-exhaustive PatternLike match in scope_resolution test#36499

Merged
poteto merged 1 commit into
facebook:pr-36173from
poteto:rust-compiler-fix-cargo-test-pattern-arms
May 20, 2026
Merged

[rust-compiler] Fix non-exhaustive PatternLike match in scope_resolution test#36499
poteto merged 1 commit into
facebook:pr-36173from
poteto:rust-compiler-fix-cargo-test-pattern-arms

Conversation

@poteto
Copy link
Copy Markdown
Collaborator

@poteto poteto commented May 20, 2026

What

cargo test --workspace (and cargo test -p react_compiler_ast) currently fails to compile on pr-36173:

error[E0004]: non-exhaustive patterns: `&mut PatternLike::TSAsExpression(_)`,
  `&mut PatternLike::TSSatisfiesExpression(_)`, `&mut PatternLike::TSNonNullExpression(_)`
  and 1 more not covered
   --> crates/react_compiler_ast/tests/scope_resolution.rs:711:11

The visit_pat helper in the scope_resolution integration test was not updated when #36492 added four TS cast-wrapper variants to PatternLike (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_expr in the same file already handles these same wrapper types: descend into the inner Expression with visit_expr, and visit the type annotation JSON (where present) with visit_json.

Why

The Rust unit-test suite is currently zero-signal — cargo test --workspace cannot even compile, let alone run. This change restores it.

Test plan

  • cargo test --workspace compiles cleanly
  • cargo test --workspace → 56 passed, 0 failed, 0 ignored
  • No changes to non-test code; isolated to one test helper

…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
@meta-cla meta-cla Bot added the CLA Signed label May 20, 2026
@github-actions github-actions Bot added the React Core Team Opened by a member of the React Core Team label May 20, 2026
@poteto poteto merged commit 8fec1bf into facebook:pr-36173 May 20, 2026
20 of 26 checks passed
@poteto poteto deleted the rust-compiler-fix-cargo-test-pattern-arms branch May 20, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant