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

Skip unreachable code when early return can be statically analysed #8890

Merged
merged 15 commits into from
Aug 1, 2024

Conversation

sokra
Copy link
Member

@sokra sokra commented Jul 31, 2024

Description

  • tracks early returns and their conditions
  • replaces unreachable code with "TURBOPACK unreachable"
  • finds hoisted declarations in unreachable code and keeps them

Testing Instructions

Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 7:51am
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 7:51am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 7:51am

Copy link
Member Author

sokra commented Jul 31, 2024

@sokra sokra marked this pull request as ready for review July 31, 2024 09:41
@sokra sokra requested a review from a team as a code owner July 31, 2024 09:41
@sokra sokra changed the title handle early returns Skip unreachable code when early return can be statically analysed Jul 31, 2024
Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Jul 31, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Jul 31, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other codes (except the tiny concerns) look good to me/

@sokra sokra enabled auto-merge (squash) August 1, 2024 07:49
@sokra sokra merged commit 5fc75a3 into main Aug 1, 2024
56 of 57 checks passed
@sokra sokra deleted the sokra/early-return branch August 1, 2024 07:56
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…ercel/turborepo#8890)

### Description

* tracks early returns and their conditions
* replaces unreachable code with `"TURBOPACK unreachable"`
* finds hoisted declarations in unreachable code and keeps them

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
* vercel/turborepo#8879 <!-- Niklas Mischkulnig -
Convert MDX errors into issues -->
* vercel/turborepo#8873 <!-- Tobias Koppers -
smarter logical combination that keeps truthy/falsy/nullish property -->
* vercel/turborepo#8890 <!-- Tobias Koppers - Skip
unreachable code when early return can be statically analysed -->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…ercel/turborepo#8890)

### Description

* tracks early returns and their conditions
* replaces unreachable code with `"TURBOPACK unreachable"`
* finds hoisted declarations in unreachable code and keeps them

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 16, 2024
* vercel/turborepo#8879 <!-- Niklas Mischkulnig -
Convert MDX errors into issues -->
* vercel/turborepo#8873 <!-- Tobias Koppers -
smarter logical combination that keeps truthy/falsy/nullish property -->
* vercel/turborepo#8890 <!-- Tobias Koppers - Skip
unreachable code when early return can be statically analysed -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants