-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler] Repro for interaction b/w outlining and idx
babel-plugin-idx enforces that its 2nd argument is an arrow function, so outlining needs to skip over lambdas that are args to idx. This PR adds a small repro highlighting the issue. ghstack-source-id: b4627ec552056f33090e2f7bc0536a6006d79d18 Pull Request resolved: #30435
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...in-react-compiler/src/__tests__/fixtures/compiler/error.idx-outlining.expect.md
This file contains 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,27 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
import idx from 'idx'; | ||
|
||
function Component(props) { | ||
// the lambda should not be outlined | ||
const groupName = idx(props, _ => _.group.label); | ||
return <div>{groupName}</div>; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{}], | ||
}; | ||
|
||
``` | ||
|
||
|
||
## Error | ||
|
||
``` | ||
The second argument supplied to `idx` must be an arrow function. (This is an error on an internal node. Probably an internal error.) | ||
``` | ||
12 changes: 12 additions & 0 deletions
12
...ckages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.idx-outlining.js
This file contains 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,12 @@ | ||
import idx from 'idx'; | ||
|
||
function Component(props) { | ||
// the lambda should not be outlined | ||
const groupName = idx(props, _ => _.group.label); | ||
return <div>{groupName}</div>; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{}], | ||
}; |