Skip to content

fix(parser): parse index signature with multiple parameter#11068

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-16-fix_parser_parse_index_signature_with_multiple_parameter
May 16, 2025
Merged

fix(parser): parse index signature with multiple parameter#11068
graphite-app[bot] merged 1 commit intomainfrom
05-16-fix_parser_parse_index_signature_with_multiple_parameter

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 16, 2025

fixes #11052

Copilot AI review requested due to automatic review settings May 16, 2025 10:05
@github-actions github-actions bot added A-parser Area - Parser A-codegen Area - Code Generation C-bug Category - Bug labels May 16, 2025
Copy link
Member Author

Boshen commented May 16, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the parser to handle index signatures with multiple parameters (emitting an error if more than one is provided), updates diagnostics and codegen formatting, and aligns example code with the new parser API.

  • Allow parsing multiple parameters in ts/types.rs and validate that exactly one is present.
  • Add a new index_signature_one_parameter diagnostic and remove outdated doc comments in diagnostics.rs.
  • Change codegen to render index signature parameters separated by commas and update examples to match the new parser return type.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/oxc_parser/src/ts/types.rs Use parse_delimited_list for index signature parameters and enforce one parameter.
crates/oxc_parser/src/diagnostics.rs Remove old doc comments and add index_signature_one_parameter.
crates/oxc_parser/src/cursor.rs Simplify loop condition by inlining cur_kind check.
crates/oxc_codegen/src/gen.rs Update index signature parameter separator from `
crates/oxc_codegen/examples/codegen.rs Adjust example to use Program directly and remove Option.
Comments suppressed due to low confidence (1)

crates/oxc_parser/src/ts/types.rs:1229

  • The call to parse_delimited_list already consumes the closing ]. The extra expect(Kind::RBrack) will look for a second ] and fail. Please remove this redundant expect.
self.expect(Kind::RBrack);

@codspeed-hq
Copy link

codspeed-hq bot commented May 16, 2025

CodSpeed Instrumentation Performance Report

Merging #11068 will not alter performance

Comparing 05-16-fix_parser_parse_index_signature_with_multiple_parameter (ef72143) with main (12b0917)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented May 16, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 05-16-fix_parser_parse_index_signature_with_multiple_parameter branch from c71e7b9 to ef72143 Compare May 16, 2025 11:22
@graphite-app graphite-app bot merged commit ef72143 into main May 16, 2025
26 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 16, 2025
@graphite-app graphite-app bot deleted the 05-16-fix_parser_parse_index_signature_with_multiple_parameter branch May 16, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parser: An index signature must have exactly one parameter.(1096)

2 participants