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][repro] Test fixture for fbt whitespace bug #30394

Merged
merged 4 commits into from
Jul 23, 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
@@ -0,0 +1,100 @@

## Input

```javascript
import fbt from 'fbt';

/**
* Currently fails with the following:
* Found differences in evaluator results
* Non-forget (expected):
* (kind: ok) <div><span>Jason !</span></div>
* Forget:
* (kind: ok) <div><span>Jason!</span></div>

*/

function Foo(props) {
return (
// prettier-ignore
<div>
<fbt desc={"Dialog to show to user"}>
<span>
<fbt:param name="user name">
{props.name}
</fbt:param>
!
</span>
</fbt>
</div>
);
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{name: 'Jason'}],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import fbt from "fbt";

/**
* Currently fails with the following:
* Found differences in evaluator results
* Non-forget (expected):
* (kind: ok) <div><span>Jason !</span></div>
* Forget:
* (kind: ok) <div><span>Jason!</span></div>

*/

function Foo(props) {
const $ = _c(2);
let t0;
if ($[0] !== props.name) {
t0 = (
<div>
{fbt._(
"{=m0}",
[
fbt._implicitParam(
"=m0",
<span>
{fbt._(
"{user name}!",
[
fbt._param(
"user name",

props.name,
),
],
{ hk: "mBBZ9" },
)}
</span>,
),
],
{ hk: "3RVfuk" },
)}
</div>
);
$[0] = props.name;
$[1] = t0;
} else {
t0 = $[1];
}
return t0;
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{ name: "Jason" }],
};

```

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fbt from 'fbt';

/**
* Currently fails with the following:
* Found differences in evaluator results
* Non-forget (expected):
* (kind: ok) <div><span>Jason !</span></div>
* Forget:
* (kind: ok) <div><span>Jason!</span></div>

*/

function Foo(props) {
return (
// prettier-ignore
<div>
<fbt desc={"Dialog to show to user"}>
<span>
<fbt:param name="user name">
{props.name}
</fbt:param>
!
</span>
</fbt>
</div>
);
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{name: 'Jason'}],
};
1 change: 1 addition & 0 deletions compiler/packages/snap/src/SproutTodoFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ const skipFilter = new Set([
'rules-of-hooks/rules-of-hooks-69521d94fa03',

// bugs
'fbt/bug-fbt-preserve-whitespace-param',
'bug-invalid-hoisting-functionexpr',
'original-reactive-scopes-fork/bug-nonmutating-capture-in-unsplittable-memo-block',
'original-reactive-scopes-fork/bug-hoisted-declaration-with-scope',
Expand Down