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

Boolean(await f()) fails #2743

Closed
adrianp opened this issue Nov 2, 2015 · 6 comments
Closed

Boolean(await f()) fails #2743

adrianp opened this issue Nov 2, 2015 · 6 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@adrianp
Copy link

adrianp commented Nov 2, 2015

The following code:

var foo = async function() {
    var bar = Boolean(await baz());
};

fails with the following error:

AssertionError: test.js: false == true
    at explodeViaTempVar ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:926:12)
    at [...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:1042:20
    at Array.forEach (native)
    at Emitter.Ep.explodeExpression ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:1041:14)
    at Emitter.Ep.explodeExpression ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:1156:12)
    at Emitter.Ep.explodeStatement ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:403:10)
    at [...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:386:12
    at Array.forEach (native)
    at Emitter.Ep.explodeStatement ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:385:22)
    at Emitter.Ep.explode ([...]/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/lib/emit.js:333:17)

One way to fix it is:

var foo = async function() {
    var bar = await baz();
    baz = Boolean(baz);
};
$ babel --version
6.0.15 (babel-core 6.0.16)
@loganfsmyth
Copy link
Member

You you make sure your node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator is fully up-to-date?

@adrianp
Copy link
Author

adrianp commented Nov 2, 2015

@loganfsmyth It's 6.0.14, the latest according the the project homepage.

@loganfsmyth
Copy link
Member

Weird. This is the same assertion that was posted about here. #2723

Would you be up for trying to make a repo to reproduce this? I'm having trouble doing it locally.

@adrianp
Copy link
Author

adrianp commented Nov 2, 2015

@loganfsmyth sure: https://github.com/adrianp/babel2743

Let me know if I can provide more details.

@loganfsmyth
Copy link
Member

That assertion has been removed, and I can't reproduce locally. Care to give it another shot?

@adrianp
Copy link
Author

adrianp commented Nov 3, 2015

Yep, seems to work now in 6.0.15 (babel-core 6.0.20), thanks!

@adrianp adrianp closed this as completed Nov 3, 2015
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 10, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 10, 2018
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
Projects
None yet
Development

No branches or pull requests

2 participants