From bd3661020e325378efd0bd2fe3e391ded9923ce0 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Thu, 9 Nov 2023 12:00:37 +0000 Subject: [PATCH] Add test for bailouts skipping compilation --- ...hout-compilation-annotation-mode.expect.md | 39 +++++++++++++++++++ ...out-without-compilation-annotation-mode.js | 13 +++++++ ...t-without-compilation-infer-mode.expect.md | 37 ++++++++++++++++++ ...-bailout-without-compilation-infer-mode.js | 12 ++++++ 4 files changed, 101 insertions(+) create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.js create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.js diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md new file mode 100644 index 0000000000..2c3d447dec --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md @@ -0,0 +1,39 @@ + +## Input + +```javascript +// @gating @panicThreshold(NONE) @compilationMode(annotation) +let someGlobal = "joe"; + +function Component() { + "use forget"; + someGlobal = "wat"; + return null; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +}; + +``` + +## Code + +```javascript +// @gating @panicThreshold(NONE) @compilationMode(annotation) +let someGlobal = "joe"; + +function Component() { + "use forget"; + someGlobal = "wat"; + return null; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +}; + +``` + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.js new file mode 100644 index 0000000000..f8e162c208 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.js @@ -0,0 +1,13 @@ +// @gating @panicThreshold(NONE) @compilationMode(annotation) +let someGlobal = "joe"; + +function Component() { + "use forget"; + someGlobal = "wat"; + return null; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md new file mode 100644 index 0000000000..ca8f6c43c1 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md @@ -0,0 +1,37 @@ + +## Input + +```javascript +// @gating @panicThreshold(NONE) @compilationMode(infer) +let someGlobal = "joe"; + +function Component() { + someGlobal = "wat"; + return
{someGlobal}
; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +}; + +``` + +## Code + +```javascript +// @gating @panicThreshold(NONE) @compilationMode(infer) +let someGlobal = "joe"; + +function Component() { + someGlobal = "wat"; + return
{someGlobal}
; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +}; + +``` + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.js new file mode 100644 index 0000000000..a9c6d0afbd --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.js @@ -0,0 +1,12 @@ +// @gating @panicThreshold(NONE) @compilationMode(infer) +let someGlobal = "joe"; + +function Component() { + someGlobal = "wat"; + return
{someGlobal}
; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [], +};