Compare commits

...

2 Commits

Author SHA1 Message Date
Mofei Zhang
768aad3784 Update on "[compiler][repro] Test fixture for fbt whitespace bug"
[ghstack-poisoned]
2024-07-19 11:51:23 -04:00
Mofei Zhang
b6196e1f73 [compiler][repro] Test fixture for fbt whitespace bug
[ghstack-poisoned]
2024-07-18 19:02:37 -04:00
3 changed files with 133 additions and 0 deletions

View File

@@ -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" }],
};
```

View File

@@ -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" }],
};

View File

@@ -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",