fix(semantic): mark TS PropertyDefinitions computed fields as type references#24233
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends oxc_semantic’s reference-flagging logic to treat computed class field keys in declare fields as ValueAsType, so that their resolved references are recorded as Type references (including resolving against import type bindings), while leaving ordinary runtime computed fields as Read references.
Changes:
- Add a
SemanticBuilder::visit_property_definitionoverride that appliesReferenceFlags::ValueAsTypetodeclare+computedclass field keys. - Add a dedicated semantic snapshot fixture covering
declare [valueKey]anddeclare [typeImportedKey]vs runtime[runtimeKey]. - Update semantic and transform conformance snapshots to reflect the new resolution behavior (net +1 pass in each suite mentioned).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_semantic/src/builder.rs | Mark computed declare class-field keys as ValueAsType during semantic traversal so references resolve as Type. |
| crates/oxc_semantic/tests/fixtures/oxc/ts/declare-computed-class-fields.ts | Add regression fixture for declared computed class-field keys (including import type). |
| crates/oxc_semantic/tests/fixtures/oxc/ts/declare-computed-class-fields.snap | Add semantic snapshot asserting Type vs Read reference flag outcomes for the fixture. |
| tasks/coverage/snapshots/semantic_typescript.snap | Update TypeScript semantic conformance snapshot to reflect one additional passing case. |
| tasks/transform_conformance/snapshots/oxc.snap.md | Update transform conformance snapshot to reflect one additional passing case. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b4062e601
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merging this PR will not alter performance
Comparing Footnotes
|
5b4062e to
3f11760
Compare
8f11e1a to
0a1d6ec
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f11760814
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3f11760 to
c018fff
Compare
0a1d6ec to
9b95632
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c018fffea1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c018fff to
acfe21b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acfe21b8d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PropertyDefinitions computed fields as type references
Merge activity
|
…references (#24233) ## Summary - resolve computed declare class-field keys through ValueAsType so their final references are Type - allow declared keys to resolve type-only import bindings while preserving Read for ordinary runtime class fields - add a red/green semantic snapshot and update conformance snapshots, yielding one additional TypeScript semantic pass and one additional transform-conformance pass
e6519f6 to
588d997
Compare
### 🚀 Features - 616bfa2 minifier: Remove unreachable code after terminating statements (#24441) (Dunqing) - ddab89a data_structures: Add `likely` and `unlikely` functions (#24368) (overlookmotel) - a3a39f9 react_compiler: Implement enableEmitHookGuards codegen (#24329) (Boshen) - b79eef7 minifier: Apply De Morgan's law to negated comparison chains in jump guards and loop tests (#24279) (Dunqing) - 34ff7b4 minifier: Drop write-only property assignments to unused local bindings by default (#24112) (Dunqing) - 1b829d8 semantic: Record const enums in EnumData (#24268) (Dunqing) - ba0944c semantic: Add `Scoping::set_symbol_span` (#24221) (camc314) ### 🐛 Bug Fixes - 7d33363 minifier: Preserve guaranteed throws from class heritage evaluation (#24349) (Dunqing) - 058a62f semantic: Track ambient contexts in `SemanticBuilder` (#24327) (camc314) - 721eb0b transformer/decorator: Scope accessor class binding (#24330) (camc314) - 1ebdce3 semantic: Allow reserved keywords in ambient declaration types (#24325) (camc314) - 460176a track-memory-allocations: Exclude arena chunks from Sys allocs (#24292) (Dunqing) - af4922b transformer: Clear lowered namespace redeclarations (#24300) (camc314) - ffd2765 semantic: Mark declared computed `MethodDefinition`s as type references (#24296) (camc314) - f17514b isolated-declarations: Emit const readonly fields as types (#24288) (camc314) - 40f769d minifier: Make `__proto__` write tracking execution-order independent (#24280) (Dunqing) - 6371fed transformer: Remove stale enum member bindings (#24272) (camc314) - f05dfab transformer: Correct symbol flags for lowered namespaces (#24271) (Dunqing) - 84eeb55 transformer: Correct symbol flags for lowered enums (#24269) (Dunqing) - c3057da transformer: Preserve generated class binding spans (#24220) (camc314) - 8260096 transformer: Correct span for lowered namespace symbol (#24222) (camc314) - 42d00d3 semantic: Mark declared class heritage as type references (#24237) (camc314) - 588d997 semantic: Mark TS `PropertyDefinition`s computed fields as type references (#24233) (camc314) - 9b95632 semantic: Mark computed method keys in `TSMethodSignature`s as type references (#24232) (camc314) ### ⚡ Performance - 5b26643 transformer_plugins: Dispatch global defines by trailing name (#23666) (Boshen) - dce0f29 react_compiler: Replace all compiled functions in a single AST walk (#24403) (Boshen) - f85f0d8 ast: Delegate inherited enum variants in clone_in and estree derives (#23555) (Boshen) - 3ff0234 allocator: Remove `unwrap` from `ReplaceWith` (#24365) (overlookmotel) - ab22e80 transformer: Fix Rust 1.97 performance regression (#24354) (camc314) - b47585c parser: Use `ReplaceWith` instead of `TakeIn` (#24018) (overlookmotel) - b227a06 minifier: Use `ReplaceWith` instead of `TakeIn` (#24017) (overlookmotel) Co-authored-by: Boshen <[email protected]>
Summary