-
Notifications
You must be signed in to change notification settings - Fork 51.2k
[Compiler Bug] Complier mark ts instantiation expression as reorderable in build hir #34488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
josephsavona
merged 15 commits into
react:main
from
zekariasasaminew:compiler-mark-TSInstantiationExpression-as-reorderable-in-BuildHIR
Sep 18, 2025
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7be94d4
TSInstantiationExpression case added
zekariasasaminew 4e17744
fixture: TSInstantiationExpression default parameter, snapshot
zekariasasaminew 5dc26b3
define id, repro is component
zekariasasaminew e6aedce
Merge branch 'main' into compiler-mark-TSInstantiationExpression-as-r…
zekariasasaminew 989505d
Merge branch 'main' into compiler-mark-TSInstantiationExpression-as-r…
zekariasasaminew 449b3ea
Merge remote-tracking branch 'upstream/main' into compiler-mark-TSIns…
zekariasasaminew ebf4880
Merge branch 'compiler-mark-TSInstantiationExpression-as-reorderable-…
zekariasasaminew 78a3b69
recursive call to check inner expr is reorderable
zekariasasaminew f92e3a1
Update fixture
zekariasasaminew 02f1944
Merge remote-tracking branch 'upstream/main' into compiler-mark-TSIns…
zekariasasaminew 1db579e
Fix prettier issue by renaming TypeScript test file from .js to .tsx
zekariasasaminew b8e3689
Merge remote-tracking branch 'upstream/main' into compiler-mark-TSIns…
zekariasasaminew 0c284b7
Update ts-instantiation-default-param.expect.md
zekariasasaminew 7590884
Merge branch 'main' into compiler-mark-TSInstantiationExpression-as-r…
zekariasasaminew bd1b3ee
Merge branch 'main' into compiler-mark-TSInstantiationExpression-as-r…
zekariasasaminew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
...mpiler/src/__tests__/fixtures/compiler/ts-instantiation-default-param.expect.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
|
|
||
| ## Input | ||
|
|
||
| ```javascript | ||
| declare function id<T>(x: T): T; | ||
|
|
||
| export function test<T = string>(value = id<string>('hi')) { | ||
| return value; | ||
| } | ||
|
|
||
| export const FIXTURE_ENTRYPOINT = { | ||
| fn: test, | ||
| params: [], | ||
| isComponent: false, | ||
| }; | ||
|
|
||
| ``` | ||
|
|
||
| ## Code | ||
|
|
||
| ```javascript | ||
| import { c as _c } from "react/compiler-runtime"; | ||
| declare function id<T>(x: T): T; | ||
|
|
||
| export function test(t0) { | ||
| const $ = _c(2); | ||
| let t1; | ||
| if ($[0] !== t0) { | ||
| t1 = t0 === undefined ? id("hi") : t0; | ||
| $[0] = t0; | ||
| $[1] = t1; | ||
| } else { | ||
| t1 = $[1]; | ||
| } | ||
| const value = t1; | ||
| return value; | ||
| } | ||
|
|
||
| export const FIXTURE_ENTRYPOINT = { | ||
| fn: test, | ||
| params: [], | ||
| isComponent: false, | ||
| }; | ||
|
|
||
| ``` | ||
|
|
||
| ### Eval output | ||
| (kind: exception) id is not defined | ||
|
zekariasasaminew marked this conversation as resolved.
Outdated
|
||
11 changes: 11 additions & 0 deletions
11
...l-plugin-react-compiler/src/__tests__/fixtures/compiler/ts-instantiation-default-param.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| declare function id<T>(x: T): T; | ||
|
|
||
| export function test<T = string>(value = id<string>('hi')) { | ||
|
zekariasasaminew marked this conversation as resolved.
Outdated
|
||
| return value; | ||
| } | ||
|
|
||
| export const FIXTURE_ENTRYPOINT = { | ||
| fn: test, | ||
| params: [], | ||
| isComponent: false, | ||
| }; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.