Skip to content
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

[compiler][ez] Enable some sprout tests that no longer need to be disabled #30591

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ export default component Foo(bar: number) {
return <Bar bar={bar} />;
}

component Bar(bar: number) {
return <div>{bar}</div>;
}

function shouldNotCompile() {}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{bar: 42}],
};

```

## Code
Expand All @@ -29,7 +38,28 @@ export default function Foo(t0) {
return t1;
}

function Bar(t0) {
const $ = _c(2);
const { bar } = t0;
let t1;
if ($[0] !== bar) {
t1 = <div>{bar}</div>;
$[0] = bar;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}

function shouldNotCompile() {}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{ bar: 42 }],
};

```


### Eval output
(kind: ok) <div>42</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ export default component Foo(bar: number) {
return <Bar bar={bar} />;
}

component Bar(bar: number) {
return <div>{bar}</div>;
}

function shouldNotCompile() {}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{bar: 42}],
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export default hook useFoo(bar: number) {
return [bar];
}

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [42],
};

```

## Code
Expand All @@ -26,5 +31,12 @@ export default function useFoo(bar) {
return t0;
}

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [42],
};

```


### Eval output
(kind: ok) [42]
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
export default hook useFoo(bar: number) {
return [bar];
}

export const FIXTURE_ENTRYPOINT = {
fn: useFoo,
params: [42],
};
8 changes: 4 additions & 4 deletions compiler/packages/snap/src/SproutTodoFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,12 @@ const skipFilter = new Set([
'template-literal',
'multi-arrow-expr-export-default-gating-test',

// TODO: we should be able to support these
'component-declaration-basic.flow',
'hook-declaration-basic.flow',
// works, but appears differently when printing
// due to optional function argument
'nested-function-with-param-as-captured-dep',
'deeply-nested-function-expressions-with-params',

// TODO: we should be able to support these
'readonly-object-method-calls',
'readonly-object-method-calls-mutable-lambda',
'preserve-memo-validation/useMemo-with-refs.flow',
Expand Down Expand Up @@ -483,7 +484,6 @@ const skipFilter = new Set([
'rules-of-hooks/rules-of-hooks-69521d94fa03',

// bugs
'bug-renaming-jsx-tag-lowercase',
'fbt/bug-fbt-plural-multiple-function-calls',
'fbt/bug-fbt-plural-multiple-mixed-call-tag',
'bug-invalid-hoisting-functionexpr',
Expand Down