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
Allow functions to redeclare vars and functions in function scopes #5248
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#gh-5247-function-redeclaration Notice: Ensure you have installed Rust nightly. If you haven't installed it yet, please first see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust, then see https://rust-lang.github.io/rustup/concepts/channels.html to learn how to install Rust nightly. or load it into the REPL: |
Codecov Report
@@ Coverage Diff @@
## master #5248 +/- ##
=======================================
Coverage 98.89% 98.89%
=======================================
Files 231 232 +1
Lines 8926 8936 +10
Branches 2332 2333 +1
=======================================
+ Hits 8827 8837 +10
Misses 40 40
Partials 59 59
|
It seems cases like these are not allowed. This PR allows them. {
var fn
function fn () {}
} |
a2e2593
to
ad51fad
Compare
Yes, please try again. So apparently the logic is still different from what I assumed: Redeclaring functions and stuff with functions is forbidden in nearly all scopes except function scopes, where apparently anything goes... Who made this up!?? |
Great! The behavior looks good to me. Yeah, it's really complicated. 🫠 |
This PR has been released as part of rollup@4.4.1. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
Apparently, the semantics for duplicate function names differ between function scopes and other scopes: In function scopes,
function
can redeclarefunction
andvar
while in other scopes it is forbidden