mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
**Description:** Fixes Flow parser support for bare `renders T` in type positions. The parser previously only recognized the `renders? T` and `renders* T` forms, so bare `renders React.Node` was parsed as a type reference named `renders` and failed on the operand. This change lets bare `renders` consume an operand type using the existing erased AST representation, while keeping invalid operand-less `renders` cases from being reinterpreted as Flow anonymous function type parameters. Validation: - `cargo fmt --all` - `cargo clippy --all --all-targets -- -D warnings` - `cargo test -p swc_ecma_parser --features flow --test flow` - `FLOW_HERMES_FILTER=types/render_types/renders.js cargo test -p swc_ecma_parser --features flow --test flow_hermes hermes_flow_error_presence_parity` Note: `cargo test -p swc_ecma_parser` still fails on the unrelated existing TypeScript fixture `errors_tests__typescript_errors__type_only_import_specifier__invalid_type_only__input_ts`, which also fails when run alone. **Related issue:** Fixes #11928