Skip to content

Commit 942eb80

Browse files
committed
[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: facebook#30435
1 parent 08b4ee8 commit 942eb80

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
## Input
3+
4+
```javascript
5+
import idx from 'idx';
6+
7+
function Component(props) {
8+
// the lambda should not be outlined
9+
const groupName = idx(props, _ => _.group.label);
10+
return <div>{groupName}</div>;
11+
}
12+
13+
export const FIXTURE_ENTRYPOINT = {
14+
fn: Component,
15+
params: [{}],
16+
};
17+
18+
```
19+
20+
21+
## Error
22+
23+
```
24+
The second argument supplied to `idx` must be an arrow function. (This is an error on an internal node. Probably an internal error.)
25+
```
26+
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import idx from 'idx';
2+
3+
function Component(props) {
4+
// the lambda should not be outlined
5+
const groupName = idx(props, _ => _.group.label);
6+
return <div>{groupName}</div>;
7+
}
8+
9+
export const FIXTURE_ENTRYPOINT = {
10+
fn: Component,
11+
params: [{}],
12+
};

0 commit comments

Comments
 (0)