fix(ast_tools): correctly parse define_index_type! macros#20580
Merged
graphite-app[bot] merged 1 commit intomainfrom Mar 20, 2026
Merged
Conversation
Member
Author
This was referenced Mar 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes ast_tools’ phase-1 loader so it distinguishes define_index_type! from define_nonmax_u32_index_type!, preventing incorrect skeleton generation (and downstream crashes) when #[ast]/#[ast_meta] is applied to index types defined via define_index_type!.
Changes:
- Update macro dispatch to treat
define_nonmax_u32_index_type!anddefine_index_type!as separate cases. - Parse the inner type correctly for
define_index_type!(= Type) while hard-codingNonMaxU32fordefine_nonmax_u32_index_type!. - Switch to building the synthetic
ItemStructviaparse_quote!instead of manualItemStructconstruction.
677b327 to
b94ce6b
Compare
24e0b60 to
8e8f2c8
Compare
Contributor
Merge activity
|
Fix a bug in `ast_tools`. It was treating `define_index_type!` macro invocations the same as `define_nonmax_u32_index_type!`, and would have crashed if we tried to add an `#[ast]` attr to any types defined with `define_index_type!`. Fix this - handle both macros correctly.
b94ce6b to
b4da52f
Compare
8e8f2c8 to
f5ecb16
Compare
Base automatically changed from
om/02-15-perf_ast_tools_reduce_data_passing_between_functions
to
main
March 20, 2026 22:24
costajohnt
pushed a commit
to costajohnt/oxc
that referenced
this pull request
Mar 22, 2026
…ect#20580) Fix a bug in `ast_tools`. It was treating `define_index_type!` macro invocations the same as `define_nonmax_u32_index_type!`, and would have crashed if we tried to add an `#[ast]` attr to any types defined with `define_index_type!`. Fix this - handle both macros correctly.
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.

Fix a bug in
ast_tools. It was treatingdefine_index_type!macro invocations the same asdefine_nonmax_u32_index_type!, and would have crashed if we tried to add an#[ast]attr to any types defined withdefine_index_type!.Fix this - handle both macros correctly.