Add (and fix) failing test of function parameter bindings in a catch block#4880
Merged
hzoo merged 2 commits intobabel:masterfrom Dec 8, 2016
Merged
Add (and fix) failing test of function parameter bindings in a catch block#4880hzoo merged 2 commits intobabel:masterfrom
hzoo merged 2 commits intobabel:masterfrom
Conversation
This test can be run in isolation via the following command: TEST_GREP='block-scoping.*function in catch' make test-only This test fails because BlockScoping#getLetReferences accidentally considers the parameters of the function declaration as let bindings in the catch scope. When the name of the catch parameter is the same as one of the function's parameter names, the function declaration will be unnecessarily wrapped to isolate its parameters from the outer scope. While the extra wrapping may not seem harmful in this case, this behavior is a symptom of a deeper problem that causes very subtle bugs in transform code involving catch parameters and function declarations. This test case was just the simplest example I could find to demonstrate the problem. I have a proposed fix for this problem that I will push as soon as the tests fail for this commit.
Contributor
Author
|
Bigger picture: this is the only remaining bug preventing the Regenerator test suite (specifically this test) from passing using the Babel implementation. |
Current coverage is 89.35% (diff: 100%)@@ master #4880 diff @@
==========================================
Files 196 196
Lines 14022 14022
Methods 1460 1460
Messages 0 0
Branches 3263 3263
==========================================
Hits 12529 12529
Misses 1493 1493
Partials 0 0
|
benjamn
added a commit
to facebook/regenerator
that referenced
this pull request
Nov 21, 2016
Note that this test still runs and passes in native Node.
Jessidhia
pushed a commit
to Jessidhia/babel
that referenced
this pull request
Dec 8, 2016
* master: update `regenerator-runtime` in `babel-polypill` (babel#4966) Temp fix for make watch [skip ci] (babel#4967) Add (and fix) failing test of function parameter bindings in a catch block (babel#4880) Upgrade regenerator-runtime to version 0.10.0. (babel#4877) Add `/.test` and `/src` to `babel-plugin-transform-regenerator` `.npmignore`. (babel#4961) [skip ci] Only base async fn arity on non-default/non-rest params - fixes babel#4891 (babel#4901) Add generator support for Import (babel#4945)
panagosg7
pushed a commit
to panagosg7/babel
that referenced
this pull request
Jan 17, 2017
…block (babel#4880) * Add failing test of function parameter bindings in a catch block. This test can be run in isolation via the following command: TEST_GREP='block-scoping.*function in catch' make test-only This test fails because BlockScoping#getLetReferences accidentally considers the parameters of the function declaration as let bindings in the catch scope. When the name of the catch parameter is the same as one of the function's parameter names, the function declaration will be unnecessarily wrapped to isolate its parameters from the outer scope. While the extra wrapping may not seem harmful in this case, this behavior is a symptom of a deeper problem that causes very subtle bugs in transform code involving catch parameters and function declarations. This test case was just the simplest example I could find to demonstrate the problem. I have a proposed fix for this problem that I will push as soon as the tests fail for this commit. * Make BlockScoping#getLetReferences ignore function parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This test can be run in isolation via the following command:
TEST_GREP='block-scoping.*function in catch' make test-onlyThis test fails because
BlockScoping#getLetReferencesaccidentally considers the parameters of the function declaration asletbindings in thecatchscope. When the name of thecatchparameter is the same as one of the function's parameter names, the function declaration will be unnecessarily wrapped to isolate its parameters from the outer scope.While the extra wrapping may not seem harmful in this case, this behavior is a symptom of a deeper problem that causes very subtle bugs in transform code involving
catchparameters and function declarations. This test case was just the simplest example I could find to demonstrate the problem.I have a proposed fix for this problem that I will push as soon as the tests fail for this commit.Pushed!