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

Allow variable and function with the same name in static blocks #14336

Closed
wants to merge 0 commits into from

Conversation

Yokubjon-J
Copy link
Contributor

@Yokubjon-J Yokubjon-J commented Mar 7, 2022

…claration in class static block #14257

Q                       A
Fixed Issues? Fixes #14257
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

it won't throw an error when var declaration and function declaration has a same name inside a static block of a class. the test file is inside packages/babel-parser/test/fixtures/es2015/class/static-block-var-and-func-same-name

@babel-bot
Copy link
Collaborator

babel-bot commented Mar 7, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51447/

@nicolo-ribaudo nicolo-ribaudo changed the title solution to [Bug]: Parser throws when var declaration and function de… Allow variable and function with the same name in static blocks Mar 7, 2022
@nicolo-ribaudo nicolo-ribaudo added pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Mar 7, 2022
@Yokubjon-J
Copy link
Contributor Author

Yokubjon-J commented Mar 7, 2022

if some checks are failing, should i make a new pull request instead? unfortunately there are some failing.

@Yokubjon-J
Copy link
Contributor Author

i am very happy to see all the tests passed, i hope it will be merged

@@ -1,4 +1,4 @@
var _typeof = require("./typeof.js")["default"];
var _typeof = require("@babel/runtime-corejs3/helpers/typeof")["default"];
Copy link
Member

Choose a reason for hiding this comment

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

Can you run make bootstrap to undo these unrelated changes?

Also, I suggest not opening pull requests from you main branch but creating a separate branch, so that we can directly push small fixes such as this one.

Copy link
Contributor Author

@Yokubjon-J Yokubjon-J Mar 9, 2022

Choose a reason for hiding this comment

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

@nicolo-ribaudo thanks, I ran make bootstrap. OK, next time I will create PRs from a separate branch. Please inform me in case there are some issues.

Copy link
Member

Choose a reason for hiding this comment

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

After running make bootstrap, you also need to commit the new changes and push it to GitHub!

Copy link
Contributor Author

@Yokubjon-J Yokubjon-J Mar 9, 2022

Choose a reason for hiding this comment

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

sorry for such a long message!!!

i reran make bootstrap and after staging when I commit changes, I get "No staged files match any of provided globs. On branch main. Your branch is up to date with 'origin/main'." message. but I anyway ran git push -u origin main and got Everything up-to-date branch 'main' set up to track 'origin/main'.

(sidenote: I also checked out packages/babel-runtime-corejs3/helpers/possibleConstructorReturn.js on my local and remote repo and saw that var _typeof = require("./typeof.js")["default"]; is changed for var _typeof = require("@babel/runtime-corejs3/helpers/typeof")["default"];)

Copy link
Member

Choose a reason for hiding this comment

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

Could you try giving me write access to your fork? It's probably somewhere in the settings of https://github.com/Yokubjon-J/babel. I can try fixing this problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

Choose a reason for hiding this comment

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

Whops sorry, this got automatically closed when I tried to push my changed. Could you reopen it, but from this new branch? https://github.com/Yokubjon-J/babel/tree/fix-14336

Also, I restored your main branch to be in sync with the main of this repository: in general I suggest never toughing it (other than syncing it with this repo), to prevent conflicts when we add new commits in this repository. You can update your local clone with git checkout main, git fetch origin and then git reset --hard origin/main. If you want to check our locally the new branch I created, you can then use git checkout fix-14336.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Parser throws when var declaration and function declaration in class static block
4 participants